summaryrefslogtreecommitdiffstats
path: root/systemservice/system_manager/server/include
diff options
context:
space:
mode:
authortakeshi_hoshina <takeshi_hoshina@mail.toyota.co.jp>2020-10-27 11:16:21 +0900
committertakeshi_hoshina <takeshi_hoshina@mail.toyota.co.jp>2020-10-27 11:16:21 +0900
commit947c78887e791596d4a5ec2d1079f8b1a049628b (patch)
tree3981e88eb8764d7180722f8466f36b756dc005af /systemservice/system_manager/server/include
parent706ad73eb02caf8532deaf5d38995bd258725cb8 (diff)
Diffstat (limited to 'systemservice/system_manager/server/include')
-rw-r--r--systemservice/system_manager/server/include/crashdetector/ss_crashdetector.h46
-rw-r--r--systemservice/system_manager/server/include/heartbeat/ss_hb_if.h67
-rw-r--r--systemservice/system_manager/server/include/heartbeat/ss_hb_session.h91
-rw-r--r--systemservice/system_manager/server/include/heartbeat/ss_hb_thread.h206
-rw-r--r--systemservice/system_manager/server/include/processlauncher/ProcessLauncher.h58
-rw-r--r--systemservice/system_manager/server/include/processlauncher/ProcessLauncher_if.h30
-rw-r--r--systemservice/system_manager/server/include/processlauncher/ss_sm_process_launcher.h111
-rw-r--r--systemservice/system_manager/server/include/processlauncher/ss_sm_process_launcher_protocol.h62
-rw-r--r--systemservice/system_manager/server/include/ss_sm_config.h543
-rw-r--r--systemservice/system_manager/server/include/ss_sm_default_paths.h42
-rw-r--r--systemservice/system_manager/server/include/ss_sm_dynamic_launch_table.h72
-rw-r--r--systemservice/system_manager/server/include/ss_sm_dynamic_launcher.h111
-rw-r--r--systemservice/system_manager/server/include/ss_sm_launch_configuration.h191
-rw-r--r--systemservice/system_manager/server/include/ss_sm_signals.h32
-rw-r--r--systemservice/system_manager/server/include/ss_sm_systemmanagerlog.h91
-rw-r--r--systemservice/system_manager/server/include/ss_sm_version.h39
-rw-r--r--systemservice/system_manager/server/include/ss_system_manager.h760
-rw-r--r--systemservice/system_manager/server/include/ss_system_manager_callbacks.h29
-rw-r--r--systemservice/system_manager/server/include/ss_system_memory_monitor.h85
-rw-r--r--systemservice/system_manager/server/include/ss_system_thread_info.h45
-rw-r--r--systemservice/system_manager/server/include/system_launcher_cfg_format.h66
21 files changed, 2777 insertions, 0 deletions
diff --git a/systemservice/system_manager/server/include/crashdetector/ss_crashdetector.h b/systemservice/system_manager/server/include/crashdetector/ss_crashdetector.h
new file mode 100644
index 00000000..ae05af40
--- /dev/null
+++ b/systemservice/system_manager/server/include/crashdetector/ss_crashdetector.h
@@ -0,0 +1,46 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for child process exit detection.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_CRASH_DETECTOR_H_ // NOLINT
+#define SS_CRASH_DETECTOR_H_
+
+#include <string>
+
+class CCrashDetector {
+ public:
+ CCrashDetector();
+ virtual ~CCrashDetector();
+ EFrameworkunifiedStatus CrashDetectorInitialize(HANDLE hApp);
+ PCSTR CrashDetectorGetThreadName();
+
+ HANDLE m_hSmQueue;
+
+ private:
+ SI_32 CrashDetectorGetThreadPriority();
+
+ HANDLE m_hApp;
+ pthread_t m_ThreadId;
+ std::string m_ThreadName;
+ SI_32 m_siPriority;
+};
+
+#endif // SS_CRASH_DETECTOR_H_ // NOLINT
diff --git a/systemservice/system_manager/server/include/heartbeat/ss_hb_if.h b/systemservice/system_manager/server/include/heartbeat/ss_hb_if.h
new file mode 100644
index 00000000..8d6618ff
--- /dev/null
+++ b/systemservice/system_manager/server/include/heartbeat/ss_hb_if.h
@@ -0,0 +1,67 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for the application heartbeat system.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef HEARTBEAT_INTERFACE_H_ // NOLINT
+#define HEARTBEAT_INTERFACE_H_
+
+#include <system_service/ss_system_manager_if.h>
+#include <system_service/ss_system_manager_if_local.h>
+
+/**
+ * Enumeration: message category
+ */
+typedef enum HB_STATUS {
+ HB_STATUS_INVALID
+ , HB_STATUS_REGISTERED
+ , HB_STATUS_GOOD
+ , HB_STATUS_FAILED
+ , HB_STATUS_TIMEOUT
+} EHBStatus;
+
+/*
+ * Structure: report message data
+ */
+typedef struct MODULE_INFO {
+#define SS_SM_HB_MAX_PROC_NAME_SIZE 16
+ EHBStatus ProcHBState;
+ UI_32 HeartBeatRetryCount;
+ // "ProcQueueName" is limited 16 bytes (included terminal-character NULL), so that the size of "THbReportData" will be lower than 4K Bytes.
+ CHAR ProcQueueName[SS_SM_HB_MAX_PROC_NAME_SIZE];
+} TSmModuleInfo;
+
+typedef struct HB_REPORT_DATA {
+ EHBStatus eEntireState; ///< entire state for a request.
+ ///< if all modules are success, it's success, otherwise failed.
+ UI_32 nNumOfModules; ///< number of modules
+ TSmModuleInfo tModuleList[SS_MAX_NUM_MODULES]; ///< module information list, which include module IDs and states
+} THbReportData;
+
+typedef struct HB_AVAIL_CHECK {
+ BOOL isOk;
+ CHAR serviceName[SS_SM_HB_MAX_PROC_NAME_SIZE];
+} THbAvailCheck;
+
+
+EFrameworkunifiedStatus HBThreadStart(HANDLE hThread);
+EFrameworkunifiedStatus HBThreadStop(HANDLE hThread);
+
+#endif // HEARTBEAT_INTERFACE_H_ // NOLINT
diff --git a/systemservice/system_manager/server/include/heartbeat/ss_hb_session.h b/systemservice/system_manager/server/include/heartbeat/ss_hb_session.h
new file mode 100644
index 00000000..5414f097
--- /dev/null
+++ b/systemservice/system_manager/server/include/heartbeat/ss_hb_session.h
@@ -0,0 +1,91 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for the application heartbeat system.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_HEARTBEAT_SESSION_H_ // NOLINT
+#define SS_HEARTBEAT_SESSION_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <system_service/ss_heartbeat_service_protocol.h>
+#include <system_service/ss_system_manager_if.h>
+#include <system_service/ss_system_manager_if_local.h>
+#include <map>
+#include <string>
+
+#include "ss_hb_if.h"
+
+// The name of the module that is trying to open a session with Heart Beat
+typedef std::string SubscriberName;
+
+/*
+ *
+ */
+class CHeartBeatSessionHandler {
+ public:
+ CHeartBeatSessionHandler();
+ virtual ~CHeartBeatSessionHandler();
+
+ EFrameworkunifiedStatus HBProcessClientResponse(HANDLE hApp);
+
+ EFrameworkunifiedStatus HBEntrySubscriber(SubscriberName &f_Subscriber); // NOLINT
+ EFrameworkunifiedStatus HBSendRequest(HANDLE hApp, SI_32 f_HeartBeatIntervalRepeat, SI_32 f_ChkIndex);
+ EFrameworkunifiedStatus HBCheckResponses(THbReportData &f_tReportData, UI_32 f_MaxHeartBeatRetryCount, // NOLINT
+ SI_32 f_HeartBeatIntervalRepeat, SI_32 f_ChkIndex);
+
+ EFrameworkunifiedStatus HBDeleteRegisteredClientEntry(HANDLE f_hThread, PSTR pQueueName);
+ EFrameworkunifiedStatus HBAvailableCheck(THbAvailCheck &check); // NOLINT
+
+ VOID HBPrintConnection();
+ VOID HBPrintStack(UI_32 f_MaxHeartBeatRetryCount);
+
+ private:
+ class HbSessionInfo {
+ public:
+ std::string szName;
+ HANDLE hSession;
+ BOOL fRunning;
+ BOOL fHeartBeatRequestSent;
+ BOOL fHeartBeatResponseReceived;
+ UI_8 HeartBeatRetryCount;
+ BOOL fHeartBeatTimedOut;
+ BOOL fisAvailability;
+
+ // Copy constructor
+ HbSessionInfo(const HbSessionInfo &f_SessionInfo) {
+ szName = f_SessionInfo.szName;
+ hSession = f_SessionInfo.hSession;
+ fRunning = f_SessionInfo.fRunning;
+ fHeartBeatRequestSent = f_SessionInfo.fHeartBeatRequestSent;
+ fHeartBeatResponseReceived = f_SessionInfo.fHeartBeatResponseReceived;
+ HeartBeatRetryCount = f_SessionInfo.HeartBeatRetryCount;
+ fHeartBeatTimedOut = f_SessionInfo.fHeartBeatTimedOut;
+ fisAvailability = f_SessionInfo.fisAvailability;
+ }
+
+ explicit HbSessionInfo(SubscriberName f_Subscriber);
+ };
+
+ typedef std::map<SubscriberName, HbSessionInfo> HbSessionMap;
+ typedef HbSessionMap::iterator HbSessionIter;
+
+ HbSessionMap m_mapHbSessions;
+};
+#endif // SS_HEARTBEAT_SESSION_H_ // NOLINT
diff --git a/systemservice/system_manager/server/include/heartbeat/ss_hb_thread.h b/systemservice/system_manager/server/include/heartbeat/ss_hb_thread.h
new file mode 100644
index 00000000..7ca8e17d
--- /dev/null
+++ b/systemservice/system_manager/server/include/heartbeat/ss_hb_thread.h
@@ -0,0 +1,206 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for the application heartbeat system.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef HEARTBEAT_WORKER_H_ // NOLINT
+#define HEARTBEAT_WORKER_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+#include <native_service/frameworkunified_multithreading.h>
+#include <system_service/ss_system_timer.h>
+
+#include "ss_hb_session.h"
+#include "ss_sm_config.h"
+
+
+class CHeartBeatThread {
+ public:
+ explicit CHeartBeatThread(HANDLE f_hThread);
+ virtual ~CHeartBeatThread();
+
+ ///////////////////////////
+ /// HBPublishAvailabilityStatus
+ /// At HeartBeat sends NTFY_Availability with availability
+ /// notification to alert client that HeartBeat is available/not available.
+ ///
+ /// \param [in] hThread
+ /// HANDLE - Handle of HeartBeat
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus HBPublishAvailabilityStatus(HANDLE hThread, BOOL f_AvailabiltyStatus);
+
+ ///////////////////////////
+ /// HBOnStartThread
+ /// Creates and starts the HeartBeat timer
+ ///
+ /// \param [in] hThread
+ /// HANDLE - Handle of HeartBeat
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus HBOnStartThread(HANDLE hThread);
+
+
+ ///////////////////////////
+ /// HBOnStopThread
+ /// Stops and deletes the HeartBeat timer
+ ///
+ /// \param [in] hThread
+ /// HANDLE - Handle of HeartBeat
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus HBOnStopThread(HANDLE hThread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// HBOnPrintConnections
+ /// Prints all active sessions connected to HeartBeat
+ ///
+ /// \param [in] hThread
+ /// HANDLE - Handle of HeartBeat
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus HBOnPrintConnections(HANDLE hThread);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// HBOnPrintStack
+ /// Prints all sessions connected to HeartBeat
+ ///
+ /// \param [in] hThread
+ /// HANDLE - Handle of HeartBeat
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus HBOnPrintStack(HANDLE hThread);
+
+ ///////////////////////////
+ /// HBOnTimerExpiry
+ /// When APP timer expires, this method sends the HeartBeat request to the client.
+ ///
+ /// \param [in] hThread
+ /// HANDLE - Handle of HeartBeat
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus HBOnTimerExpiry(HANDLE hThread);
+
+ ///////////////////////////
+ /// HBOnClientResponse
+ /// When the response from a client is received, this method updates the map
+ /// containing client status to indicate the response.
+ ///
+ ///
+ /// \param [in] hThread
+ /// HANDLE - Handle of HeartBeat
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus HBOnClientResponse(HANDLE hThread);
+
+ ///////////////////////////
+ /// HBOnPeriodicStatusRequest
+ /// Reply to Status request from System Manager
+ ///
+ /// \param [in] hThread
+ /// HANDLE - Handle of HeartBeat
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus HBOnPeriodicStatusRequest(HANDLE hThread);
+
+
+ ///////////////////////////
+ /// HBOnAvailCheckRequest
+ /// Reply to service's availability condition request from System Manager
+ ///
+ /// \param [in] hThread
+ /// HANDLE - Handle of HeartBeat
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus HBOnAvailCheckRequest(HANDLE hThread);
+
+ ///////////////////////////
+ /// HBOnRemoveModule
+ /// Upon receiving delete module notification from sysmgr, this method removes
+ /// a client from the client session map.
+ ///
+ /// \param [in] hThread
+ /// HANDLE - Handle of HeartBeat
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus HBOnRemoveModule(HANDLE hApp);
+
+ ///////////////////////////
+ /// HBOnAppendModule
+ /// Upon receiving append module notification from sysmgr, this method append
+ /// a client from the client session map.
+ ///
+ /// \param [in] hThread
+ /// HANDLE - Handle of HeartBeat
+ ///
+ /// \return status
+ /// EFrameworkunifiedStatus - success or error
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ EFrameworkunifiedStatus HBOnAppendModule(HANDLE hApp);
+
+ // Service notification handlers
+ EFrameworkunifiedStatus HBSendRequest(HANDLE hApp);
+ EFrameworkunifiedStatus HBCheckHeartBeatResponses(HANDLE hThread);
+ EFrameworkunifiedStatus HBDeleteRegisteredClientEntry(PSTR pModuleName);
+
+ EFrameworkunifiedStatus HeartBeatTimerInit(HANDLE hThread);
+ EFrameworkunifiedStatus HeartBeatTimersDelete(void);
+
+ private:
+ CHeartBeatSessionHandler m_oSessionHandler;
+ TimerCtrl m_oTimerCtrl;
+ UI_32 m_HBTimerID;
+ HBConfigParameters m_HBConfigParams;
+ SI_32 m_NextChkIndex;
+ HANDLE m_hThread;
+};
+#endif // HEARTBEAT_WORKER_H_ // NOLINT
diff --git a/systemservice/system_manager/server/include/processlauncher/ProcessLauncher.h b/systemservice/system_manager/server/include/processlauncher/ProcessLauncher.h
new file mode 100644
index 00000000..409524f0
--- /dev/null
+++ b/systemservice/system_manager/server/include/processlauncher/ProcessLauncher.h
@@ -0,0 +1,58 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for process launching and termination.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef CPROCESSLAUNCHER_H_ // NOLINT
+#define CPROCESSLAUNCHER_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <system_service/ss_system_process.h>
+#include <string>
+#include "ss_system_manager.h"
+#include "ss_sm_process_launcher.h"
+
+/*
+ *
+ */
+class CProcessLauncher {
+ public:
+ CProcessLauncher();
+ explicit CProcessLauncher(void *);
+ virtual ~CProcessLauncher();
+
+ EFrameworkunifiedStatus PLOnCmdTerminateModule(HANDLE hThread);
+ EFrameworkunifiedStatus PLOnCmdModuleStatus(HANDLE hThread);
+ EFrameworkunifiedStatus PLOnCmdLaunchModule(HANDLE hThread);
+ EFrameworkunifiedStatus PLOnCmdRelaunchModule(HANDLE hThread);
+ EFrameworkunifiedStatus PLOnCmdHeartbeatStatusReq(HANDLE hThread);
+ EFrameworkunifiedStatus PLOnCmdStop(HANDLE hThread);
+ EFrameworkunifiedStatus PLOnCmdStart(HANDLE hThread);
+ protected:
+ ProcessMap m_mapOfProcesses;
+
+ private:
+ EFrameworkunifiedStatus PLCmdLaunchModule(HANDLE hThread,
+ UI_32 f_protocol_ID,
+ std::string f_protocol_str);
+ EFrameworkunifiedStatus PLLaunchModule(HANDLE hThread, T_ProcessLaunchResp &f_LaunchRespData); // NOLINT
+ EFrameworkunifiedStatus PLTerminateModule(HANDLE hThread, T_ProcessLauncherTerminationResp *f_pTerminateRespData = NULL);
+};
+#endif // CPROCESSLAUNCHER_H_ // NOLINT
diff --git a/systemservice/system_manager/server/include/processlauncher/ProcessLauncher_if.h b/systemservice/system_manager/server/include/processlauncher/ProcessLauncher_if.h
new file mode 100644
index 00000000..f8d047a9
--- /dev/null
+++ b/systemservice/system_manager/server/include/processlauncher/ProcessLauncher_if.h
@@ -0,0 +1,30 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for process launching and termination.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef PROCESSLAUNCHER_IF_H_ // NOLINT
+#define PROCESSLAUNCHER_IF_H_
+
+EFrameworkunifiedStatus ProcessLauncherOnStart(HANDLE hThread);
+EFrameworkunifiedStatus ProcessLauncherOnStop(HANDLE hThread);
+
+#endif // NOLINT
+
diff --git a/systemservice/system_manager/server/include/processlauncher/ss_sm_process_launcher.h b/systemservice/system_manager/server/include/processlauncher/ss_sm_process_launcher.h
new file mode 100644
index 00000000..1ca177cb
--- /dev/null
+++ b/systemservice/system_manager/server/include/processlauncher/ss_sm_process_launcher.h
@@ -0,0 +1,111 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for process launching and termination.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_SM_PROCESS_LAUNCHER_H_ // NOLINT
+#define SS_SM_PROCESS_LAUNCHER_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <system_service/ss_system_manager_protocol.h>
+#include <system_service/ss_system_manager_protocol_local.h>
+
+#include "ss_sm_config.h"
+
+///////////////////////////////////////////////////////////////////////////////
+/// System manager launches the modules using the process launcher.
+/// The system manager launches the modules by sending the data about the process to be launched by
+/// the message ePLThrdCmd_LAUNCH_MODULE_REQST.
+/// SM => PL
+///////////////////////////////////////////////////////////////////////////////
+typedef struct {
+ CHAR name[SS_SM_MAX_MODULE_NAME_LENGTH];
+ CHAR path[SS_SM_MAX_MODULE_PATH_LENGTH];
+ CHAR args[SS_SM_MAX_MODULE_ARGS_LENGTH];
+ UI_32 priority;
+ CHAR logging_mask[SS_SM_MAX_MODULE_LOG_MASK_LENGTH];
+ GroupLaunchMapIter groupIterator;
+ ModuleLaunchListIter moduleIterator;
+ int cpu_assign;
+} T_ProcessLauncherLaunchReq;
+
+///////////////////////////////////////////////////////////////////////////////
+/// After successfully launching an module, the process launcher sends the
+/// pid of the launched process along with the process name and arguments
+/// by the message ePLThrdCmd_LAUNCH_MODULE_RESP.
+/// System manager will verify the process name and the arguments and update
+/// the pid in its process table.
+///
+/// This message will be sent for every module that is launched by process launcher.
+/// Launch success returns a number > 0 for ProcessID, which is the PID of the
+/// newly created process.
+/// Launch failure returns -1 for ProcessID.
+/// PL => SM
+///////////////////////////////////////////////////////////////////////////////
+/// The response of the module relaunch message from process launcher to system
+/// manager ePLThrdCmd_RELAUNCH_MODULE_RESP is defined by the below structure
+/// A process ID value of > 0 indicates the success of the operation.
+/// The process name and args are used to ensure correct mapping of requests
+/// and responses.
+/// PL => SM
+///////////////////////////////////////////////////////////////////////////////
+typedef struct {
+ SI_32 pid;
+ CHAR name[SS_SM_MAX_MODULE_NAME_LENGTH];
+ CHAR path[SS_SM_MAX_MODULE_PATH_LENGTH];
+ CHAR args[SS_SM_MAX_MODULE_ARGS_LENGTH];
+ UI_32 priority;
+ GroupLaunchMapIter groupIterator;
+ ModuleLaunchListIter moduleIterator;
+} T_ProcessLaunchResp;
+
+///////////////////////////////////////////////////////////////////////////////
+/// System manager terminates the process when it detects there is something
+/// wrong with the process. The system manager send the message
+/// ePLThrdCmd_TERMINATE_MODULE_REQST to process launcher as required.
+/// The request data is defined as below
+/// SM => PL
+///////////////////////////////////////////////////////////////////////////////
+typedef T_ProcessLauncherLaunchReq T_ProcessLauncherTerminationReq;
+
+///////////////////////////////////////////////////////////////////////////////
+/// The response of the module termination response message from process
+/// launcher to system manager
+/// ePLThrdCmd_TERMINATE_MODULE_RESP is defined by the below structure
+/// A ProcessID value of 0 indicates the success of the operation.
+/// The process name and args are used to ensure correct mapping of requests
+/// and responses.
+/// PL => SM
+///////////////////////////////////////////////////////////////////////////////
+typedef T_ProcessLaunchResp T_ProcessLauncherTerminationResp;
+
+///////////////////////////////////////////////////////////////////////////////
+/// The system manager requests a module relaunch by the message
+/// ePLThrdCmd_RELAUNCH_MODULE_REQST.
+/// The message data is described by the below structure
+/// The old process ID is passed sent in the request and a new process ID is
+/// expected in the response.
+/// The process launcher launches the module and does internal retries for this
+/// kind of request in case of failure.
+/// SM => PL
+///////////////////////////////////////////////////////////////////////////////
+typedef T_ProcessLauncherLaunchReq T_ProcessLauncherRelaunchReq;
+
+#endif // SS_SM_PROCESS_LAUNCHER_H_ // NOLINT
diff --git a/systemservice/system_manager/server/include/processlauncher/ss_sm_process_launcher_protocol.h b/systemservice/system_manager/server/include/processlauncher/ss_sm_process_launcher_protocol.h
new file mode 100644
index 00000000..cd698326
--- /dev/null
+++ b/systemservice/system_manager/server/include/processlauncher/ss_sm_process_launcher_protocol.h
@@ -0,0 +1,62 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for process launching and termination.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_SM_PROCESS_LAUNCHER_PROTOCOL_H_ // NOLINT
+#define SS_SM_PROCESS_LAUNCHER_PROTOCOL_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <system_service/ss_system_manager_protocol_local.h>
+#include <system_service/ss_system_manager_protocol.h>
+
+typedef enum _ESMPLThreadCommandIds {
+ //// <
+ ePLThrdCmd_LAUNCH_MODULE_REQST = 0x543, ///< SM --> SM.ProcessLauncher
+
+ //// <
+ ePLThrdCmd_LAUNCH_MODULE_RESP, ///< SM.ProcessLauncher --> SM
+
+ //// <
+ ePLThrdCmd_TERMINATE_MODULE_REQST, ///< SM --> SM.ProcessLauncher
+
+ //// <
+ ePLThrdCmd_TERMINATE_MODULE_RESP, ///< SM.ProcessLauncher --> SM
+
+ //// <
+ ePLThrdCmd_RELAUNCH_MODULE_REQST, ///< SM --> SM.ProcessLauncher
+
+ //// <
+ ePLThrdCmd_RELAUNCH_MODULE_RESP, ///< SM.ProcessLauncher --> SM
+
+ //// <
+ ePLThrdCmd_MODULE_STATUS_REQST, ///< SM --> SM.ProcessLauncher
+
+ //// <
+ ePLThrdCmd_THREAD_STATUS_REQST, ///< SM --> SM.ProcessLauncher
+
+ //// <
+ ePLThrdCmd_THREAD_STATUS_RESP, ///< SM.ProcessLauncher --> SM
+
+ ePLThrdCmd_NONE, ///< Not sent. Used for initialization.
+} ESMPLThreadCommandIds;
+
+
+#endif // SS_SM_PROCESS_LAUNCHER_PROTOCOL_H_ // NOLINT
diff --git a/systemservice/system_manager/server/include/ss_sm_config.h b/systemservice/system_manager/server/include/ss_sm_config.h
new file mode 100644
index 00000000..19736f67
--- /dev/null
+++ b/systemservice/system_manager/server/include/ss_sm_config.h
@@ -0,0 +1,543 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for System Manager configuration.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_SM_CONFIG_H_ // NOLINT
+#define SS_SM_CONFIG_H_
+
+#include <native_service/ns_config_parser_if.h>
+#include <system_service/ss_system_types.h>
+#include <system_service/ss_system_manager_if.h>
+#include <system_service/ss_system_manager_if_local.h>
+#include <system_service/ss_system_manager_protocol.h>
+#include <system_service/ss_string_maps.h>
+#include <list>
+#include <map>
+#include <string>
+#include <vector>
+#include "ss_sm_process_launcher_protocol.h"
+
+
+/// All timer values are **position-dependent** in the timer calls ! These
+/// defines are currently all used as Start and Restart Seconds parameters.
+/// \param [in] id
+/// UI_32 - timer id that you want to start
+/// \param [in] ss
+/// UI_32 - Start time in seconds
+/// \param [in] sms
+/// UI_32 - Start time in milliseconds
+/// \param [in] rs
+/// UI_32 - Repeat time in seconds
+/// \param [in] rms
+/// UI_32 - Repeat time in milliseconds
+#define SS_GROUP_LAUNCH_TIMER_CONFIG (3)
+#define SS_HEARTBEAT_MONITOR_TIMER_CONFIG (10)
+#define SS_PROCESSLAUNCHER_MONITOR_TIMER_CONFIG (10)
+#define SS_CLIENT_START_MONITOR_TIMER_CONFIG (3)
+#define SS_CLIENT_STOP_MONITOR_TIMER_CONFIG (1)
+#define SS_NPP_STATUS_CHECK_MONITOR_TIME_SEC (5)
+#define SS_LAUNCH_GROUP_TRIGGER_TIMER_CONFIG (10)
+// size of the internal debug dump buffer
+#define SS_SM_DEBUG_DUMP_MAX_SIZE (12288u)
+// number of _CWORD56_ command history log entries for the debug dump
+#define SS_SM__CWORD56__CMD_HIST_SIZE (10u)
+// number of timer history log entries for the debug dump
+#define SS_SM_TIMER_CMD_HIST_SIZE (10u)
+// number of message history log entries for the debug dump
+#define SS_SM_CMD_HIST_SIZE (20u)
+// number of publishing history log entries for the debug dump
+#define SS_SM_PUB_CMD_HIST_SIZE (5u)
+// number of error history log entries for the debug dump
+#define SS_SM_ERR_HIST_SIZE (5u)
+
+// When occurs repeat to abnormal rebooting, logging cause of error at first time and next time.
+// When it occurs "ILG_RESET", Maximum number of log is 4 so that the log will be stored at the just after the startup.
+// Need reconsideration if maximum number of abnormal logging is less than 4 using SSL.
+#define SS_SM_ERR_LOGGING_LIMIT (8)
+
+// Maximum number of continuous processing of "NaviReset" by errors.
+// It try to recover by NaviDet when it exceeds this limit.
+#define SS_SM_ERR_NAVI_RESET_LIMIT (5)
+
+typedef enum {
+ MODULE_STATE_INVALID = 0 /// Initial state of all modules
+ , MODULE_STATE_SKIPPED /// Non-critical module has crossed max re-launch limit
+ /// or hSession was null when attempted to start
+ , MODULE_STATE_LAUNCHING /// Module launch has been requested
+ , MODULE_STATE_LAUNCHED /// Module has been launched but a session
+ /// connection has NOT been established
+ , MODULE_STATE_LAUNCH_FAILED /// Oops
+ , MODULE_STATE_CONNECTED /// A session connection has been established
+ , MODULE_STATE_START_SENT /// SM has sent START to the module
+ , MODULE_STATE_START_FAILED /// FrameworkunifiedSendMsg(SS_SM_START) failed
+ , MODULE_STATE_STARTED /// Module has replied START Complete to SM
+ , MODULE_STATE_STOP_SENT /// SM has sent STOP to the module
+ , MODULE_STATE_STOP_FAILED /// FrameworkunifiedSendMsg(SS_SM_STOP) failed
+ , MODULE_STATE_STOPPED /// Module has replied STOP Complete to SM
+ , MODULE_STATE_START_PRE_SENT //!< SM has sent Pre-boot start to the module
+ , MODULE_STATE_START_PRE_FAILED //!< FrameworkunifiedSendMsg(SS_SM_PRE_START) failed
+ , MODULE_STATE_STARTED_PRE //!< Module has replied Pre-boot start Complete to SM
+ , MODULE_STATE_STOP_PRE_SENT //!< SM has sent Pre-boot stop to the module
+ , MODULE_STATE_STOP_PRE_FAILED //!< FrameworkunifiedSendMsg(SS_SM_PRE_STOP) failed
+ , MODULE_STATE_STOPPED_PRE //!< Module has replied Pre-boot stopComplete to SM
+ , MODULE_STATE_START_BACKGROUND_SENT //!< SM has sent Background-boot start to the module
+ , MODULE_STATE_START_BACKGROUND_FAILED //!< FrameworkunifiedSendMsg(SS_SM_BACKGROUND_START) failed
+ , MODULE_STATE_STARTED_BACKGROUND //!< Module has replied Background-boot start Complete to SM
+ , MODULE_STATE_STOP_BACKGROUND_SENT //!< SM has sent Background-boot stop to the module
+ , MODULE_STATE_STOP_BACKGROUND_FAILED //!< FrameworkunifiedSendMsg(SS_SM_BACKGROUND_STOP) failed
+ , MODULE_STATE_STOPPED_BACKGROUND //!< Module has replied Background-boot stop Complete to SM
+} SMModuleState;
+//
+// Module State string map type
+typedef std::map<SMModuleState, std::string> SMModuleStateStrMapType;
+
+typedef enum {
+ MODULE_DEBUG_DUMP_STATE_NOT_REQUESTED = 0
+ , MODULE_DEBUG_DUMP_STATE_REQUEST_SENT
+ , MODULE_DEBUG_DUMP_STATE_RESPONSE_RECEIVED
+} SMModuleDebugDumpState;
+
+typedef std::map<SMModuleDebugDumpState, std::string> SMModuleDebugDumpStateStrMapType;
+
+/*
+<?xml version="1.0" encoding="UTF-8"?>
+<Configuration>
+ <!-- System Service Launch control elements -->
+ <SystemManager>
+ <Launch>
+ <Group1>
+ <group_name>CoreModules</group_name>
+ <group_id>1</group_id>
+ <Member1>
+ <name>TRUE</name>
+ <path>1</path>
+ <priority>200</priority>
+ <critical>TRUE</critical>
+ <retry_cnt>1</retry_cnt>
+ <arguments></arguments>
+ <logging_mask></logging_msk>
+ <restart>group</restart>
+ <shudown_critical></shudown_critical>
+ <shudown_wait_time></shudown_wait_time>
+ </Member1>
+ <Member2>
+ <name>TRUE</name>
+ <path>1</path>
+ <priority>200</priority>
+ <critical>TRUE</critical>
+ <retry_cnt>1</retry_cnt>
+ <arguments></arguments>
+ <logging_mask></logging_msk>
+ <restart>me</restart>
+ <shudown_critical></shudown_critical>
+ <shudown_wait_time></shudown_wait_time>
+ </Member2>
+ </Group1>
+ </Launch>
+ </SystemManager>
+</Configuration>
+*/
+
+//******************************************************************************
+//* CTimeSpan class *
+//* *
+class CTimeSpan {
+ public:
+ CTimeSpan(): initial(0), final(0), delta(0) {}
+ CTimeSpan(UI_64 f_initial) // NOLINT
+ : initial(f_initial), final(0), delta(0) {}
+ ~CTimeSpan() {}
+ /*
+ * Set Initial time, reset Final and Delta to zero, return time
+ */
+ UI_64 Begin();
+ /*
+ * Set Final time, calculate Delta time, return time
+ */
+ UI_64 End();
+ UI_64 GetInitial();
+ UI_64 GetFinal();
+ UI_64 GetDelta();
+ UI_64 GetTimeMilliseconds();
+
+ private:
+ UI_64 initial;
+ UI_64 final;
+ UI_64 delta;
+}; // End of class CTimeSpan
+//******************************************************************************
+
+
+typedef enum {
+ NotStopped,
+ StoppedByModuleStopComplete,
+ StoppedByModuleStopFail,
+ StoppedByGroupStopTimeout,
+ StoppedByCriticalAppsTimeout,
+ StoppedByModulePreStopComplete,
+ StoppedByModulePreStopFail,
+ StoppedByModuleBackgroundStopComplete,
+ StoppedByModuleBackgroundStopFail
+} EStopReasonType;
+
+typedef enum {
+ NotStarted,
+ StartedByModuleStartComplete,
+ StartedByModuleStartFail,
+ StartedByModulePreStartComplete,
+ StartedByModulePreStartFail,
+ StartedByModuleBackgroundStartComplete,
+ StartedByModuleBackgroundStartFail
+} EStartReasonType;
+
+//******************************************************************************
+//* CTimeEvent class *
+//* *
+template <typename EEventType>
+class CTimeEvent : public CTimeSpan {
+ public:
+ CTimeEvent() {
+ bzero(&m_eventReason, sizeof(m_eventReason));
+ }
+ ~CTimeEvent() {}
+
+ VOID SetReason(EEventType f_eventReason)
+ { m_eventReason = f_eventReason; }
+ private:
+ EEventType m_eventReason;
+}; // End of class CTimeEvent
+//******************************************************************************
+
+typedef enum {
+ NotRelaunched,
+ RelaunchSafe,
+ RelaunchErr
+} ERelaunchStatusType;
+
+
+typedef CTimeEvent<EStartReasonType> CStartReason;
+typedef CTimeEvent<EStopReasonType> CStopReason;
+typedef CHAR TUserNameBuffer[128]; // TODO(yaomingwu): Stuff. Does Posix define a useful
+ // constant representing max length of user id?
+
+class ModuleLaunchParams {
+ public:
+ // Move to private to prevent direct access
+ // SMModuleState module_state;
+ //
+ SS_String name;
+ SS_String path;
+ SS_String arguments;
+ SS_String restart;
+ UI_32 configuration_priority;
+ int cpu_assign;
+ UI_32 previous_priority;
+ UI_32 current_priority;
+ BOOL critical;
+ UI_32 retry_cnt;
+ SS_String logging_msk_str;
+ BOOL is_start_required;
+ BOOL shutdown_critical;
+ UI_32 shutdown_wait_time;
+ UI_32 fast_shutdown_wait_time;
+ SI_32 pid;
+ HANDLE hsession;
+ UI_32 relaunch_count;
+ ERelaunchStatusType relaunch_status;
+ UI_32 group_id;
+ TUserNameBuffer unix_user_name;
+
+ BOOL m_serviceAvailability; // Not set because it does not watch Availability for speeding up start up process.
+
+ CStartReason m_startReason;
+ CStopReason m_stopReason;
+
+ ModuleLaunchParams();
+ ~ModuleLaunchParams();
+ SMModuleState GetModuleState(void);
+ BOOL IsModuleState(SMModuleState f_moduleState);
+ BOOL IsModuleConnected() const;
+ VOID SetModuleState(SMModuleState f_moduleState, BOOL f_bLog = TRUE);
+ std::string ModuleStateStr(void);
+
+ SMModuleDebugDumpState GetModuleDebugDumpState(void);
+ std::string GetModuleDebugDumpStateStr(void);
+ VOID SetModuleDebugDumpState(SMModuleDebugDumpState f_moduleDebugDumpState, BOOL f_bLog = TRUE);
+ EFrameworkunifiedStatus SendMsgAndUpdateState(
+ const UI_32 f_iCmd, const T_SS_SM_START_DataStructType* const f_startData);
+ EFrameworkunifiedStatus SendMsgAndUpdateState(T_SS_SM_STOP_DataStruct const* f_stopData);
+
+ EFrameworkunifiedStatus GetPriority(UI_32& f_Priority); // NOLINT
+ EFrameworkunifiedStatus SetPriority(UI_32 f_Priority);
+
+ BOOL IsAGLUnit(void) const { return is_agl_unit; }
+ BOOL IsAGLResetHistoryDisable(void) const { return disable_agl_resethistory; }
+ BOOL IsNonAGLResetHistoryDisable(void) const { return disable_nonagl_resethistory; }
+ void SetAGLUnit(BOOL f_is_agl_unit) { is_agl_unit = f_is_agl_unit; }
+ void SetAGLResetHistoryDisable(BOOL f_disable_agl_resethistory) {
+ disable_agl_resethistory = f_disable_agl_resethistory;
+ }
+ void SetNonAGLResetHisoryDisable(BOOL f_disable_nonagl_resethistory) {
+ disable_nonagl_resethistory = f_disable_nonagl_resethistory;
+ }
+
+ private:
+ SMModuleState m_moduleState;
+ SMModuleStateStrMapType m_ModuleStateStrMap;
+ SMModuleDebugDumpState m_ModuleDebugDumpState;
+ SMModuleDebugDumpStateStrMapType m_ModuleDebugDumpStateStrMap;
+ BOOL is_agl_unit;
+ BOOL disable_agl_resethistory;
+ BOOL disable_nonagl_resethistory;
+};
+
+typedef std::list<ModuleLaunchParams> ModuleLaunchList;
+typedef ModuleLaunchList::iterator ModuleLaunchListIter;
+
+typedef struct _GroupLaunchInfo { // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length)
+ BOOL launch_complete;
+ BOOL start_complete;
+ BOOL stop_complete;
+ SS_String name;
+ UI_32 id;
+ UI_32 grp_launch_wait;
+ UI_32 grp_wait_for_trigger;
+ ModuleLaunchList modules;
+} GroupLaunchInfo;
+
+typedef std::list<GroupLaunchInfo> GroupLaunchList;
+typedef GroupLaunchList::iterator GroupLaunchListIter;
+
+typedef std::map<UI_32, GroupLaunchInfo> GroupLaunchMap;
+typedef GroupLaunchMap::iterator GroupLaunchMapIter;
+
+typedef std::list<GroupLaunchList> GroupList;
+typedef GroupList::iterator GroupListIter;
+
+// Process Binary Name (key) to ModuleLaunchList iterator (ModuleLaunchParams).
+typedef std::map<std::string, ModuleLaunchListIter>ProcessNameMap;
+typedef ProcessNameMap::iterator ProcessNameMapIter;
+
+// Config Parameters specific to Heart Beat Thread
+typedef struct _HBConfigParams {
+ SI_32 MaxHeartBeatRetryCount; /// Retry heart beat check before error report is sent to SM
+ SI_32 ApplicationHeartBeatIntervalInitial; /// Initial Timer interval
+ /// between two heart beat requests & response check
+ SI_32 ApplicationHeartBeatIntervalRepeat; /// Repeat Timer interval between two heart beat requests & response check
+} HBConfigParameters;
+
+typedef struct _CDConfigParams {
+ BOOL CrashDetectorEnabled;
+} CDConfigParameters;
+
+typedef struct _SLMConfigParams { // SLM - System Low Memory
+ SI_32 SLMTimerValue;
+ SI_32 SLMMaxRetryCount;
+ SI_32 SLMThresholdValue;
+ SI_32 SLMSystemmanagerLogIntervalMs;
+} SLMConfigParameters;
+
+typedef struct _UserMModeConfigParams {
+ BOOL IsUserModeNotificationABOOL;
+} UserModeConfigParameters;
+
+typedef struct _ModuleConnectTimeConfigParams {
+ SI_32 ModuleConnectionNumTimesToCheck;
+ SI_32 ModuleConnectionTimeOutSec;
+ SI_32 ModuleStartRespTimeOutSec;
+} ModuleConfigParams;
+
+typedef struct _CriticalAppsMaxShutdownTime {
+ SI_32 CriticalAppsMaxShutdownTimeFastSleep;
+ SI_32 CriticalAppsMaxShutdownTimeNormalReset;
+} CriticalAppsMaxShutdownTime;
+
+typedef struct _ConfigurationData {
+ // Parameters specific to System Manager
+
+ // Parameters specific to Heart Beat Thread
+ HBConfigParameters HBConfig;
+
+ // Parameters specific to Launcher Thread
+
+ // Parameters specific to Crash Detector Thread
+ CDConfigParameters CDConfig;
+
+ // Parameters specific to System Low Memory
+
+ // Parameters specific to Sys Low Memory Thread
+ SLMConfigParameters SLMConfig;
+
+ // Parameters specific to User Mode Notification Data Structure
+ UserModeConfigParameters UMConfig;
+
+ // Parameters specific to Module connection timeout with SM
+ ModuleConfigParams MCConfig;
+
+ // Parameters specific to Critical Apps Max shutdown time
+ CriticalAppsMaxShutdownTime CAMSTConfig;
+} ConfigurationData;
+
+typedef std::vector<UI_32> LaunchOrderedVector;
+typedef LaunchOrderedVector::iterator LaunchOrderedIter;
+
+class SMConfigParams {
+ public:
+ SMConfigParams();
+ virtual ~SMConfigParams();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// LoadSMConfigParameters
+ /// \brief Read System Manager configuration parameters from cfg file or
+ /// use defaults values in case cfg file is not available
+ ///
+ /// \param [in] f_ConfigParams & - Ref to ConfigurationData that get populated.
+ /// \param [in] f_FileName - Configuration file name.
+ ///
+ /// \return BOOL
+ /// BOOL - TRUE or FALSE
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL LoadSMConfigParameters(ConfigurationData& f_ConfigParams, // NOLINT
+ SS_String f_FileName);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// GetSMConfigInformation
+ /// \brief Read config data from cfg file and populate the configuration data structure
+ ///
+ /// \param [in] f_ConfigParams & - Ref to ConfigurationData that get populated.
+ /// \param [in] f_FileName - Configuration file name.
+ ///
+ /// \return BOOL
+ /// BOOL - TRUE or FALSE
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL GetSMConfigInformation(ConfigurationData& f_ConfigParams, // NOLINT
+ SS_String f_FileName);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// PrintConfigInfo
+ /// \brief Print the configuration data stored in config structure
+ ///
+ /// \param [in] configata
+ /// ConfigurationData & - Ref to structure that get populated.
+ ///
+ /// \return VOID
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ VOID PrintConfigInfo(ConfigurationData const& f_ConfigParams);
+};
+
+class SysMgrConfiguration {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// SysMgrConfiguration
+ /// \brief
+ ///
+ /// \return NA
+ ///
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ SysMgrConfiguration();
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// ~SysMgrConfiguration
+ /// \brief
+ ///
+ /// \return NA
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ virtual ~SysMgrConfiguration();
+
+// ////////////////////////////////////////////////////////////////////////////////////////////
+// /// LoadParameters
+// /// \brief
+// ///
+// /// \param [in] groups
+// /// GroupLaunchList & - Ref to GroupLaunchList that get populated.
+// ///
+// /// \return BOOL
+// /// BOOL - TRUE or FALSE
+// ////////////////////////////////////////////////////////////////////////////////////////////
+// BOOL LoadParameters(GroupLaunchMap & groups_map);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// LoadParametersCfg
+ /// \brief
+ ///
+ /// \param [in] groups
+ /// GroupLaunchList & - Ref to GroupLaunchList that gets populated.
+ /// ProcessNameMap & - Ref to ProcessNameMap that gets populated.
+ /// LaunchOrderedVector & - Ref to LaunchOrderedVector that gets populated.
+ ///
+ /// \param [in] f_launchOrderName - launch order name.
+ ///
+ /// \return BOOL
+ /// BOOL - TRUE or FALSE
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ BOOL LoadParametersCfg(GroupLaunchMap& groups_map, // NOLINT
+ ProcessNameMap& f_processNameMap, // NOLINT
+ LaunchOrderedVector& f_OrderList, // NOLINT
+ SS_String& f_launchOrderName, // NOLINT
+ SS_String& f_launchCfgFn); // NOLINT
+
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// PrintGroupInfo
+ /// \brief Print method for GroupLaunchInfo only prints the group info not the module info
+ ///
+ /// \param [in] refGrpInfo
+ /// GroupLaunchInfo & - Ref to a GroupLaunchInfo object that will be printed.
+ ///
+ /// \return VOID
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ VOID PrintGroupInfo(GroupLaunchInfo& refGrpInfo); // NOLINT
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// PrintModuleInfo
+ /// \brief Print method for a Module's Params.
+ ///
+ /// \param [in] refMbrInfo
+ /// ModuleLaunchParams & - Ref to ModuleLaunchParams object that will be printed.
+ ///
+ /// \return VOID
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ VOID PrintModuleInfo(ModuleLaunchParams& refMbrInfo); // NOLINT
+
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ /// PrintAllInfo
+ /// \brief Print all the information in the GroupLaunchList.
+ ///
+ /// \param [in] refGrpList
+ /// GroupLaunchList & - Ref to GroupLaunchList object that will be printed.
+ ///
+ /// \return VOID
+ ////////////////////////////////////////////////////////////////////////////////////////////
+ VOID PrintAllInfo(GroupLaunchMap& refGrpMap); // NOLINT
+
+ protected:
+ // define all the configuration parameters that will be used to get data
+
+ CNSConfigReader * l_pReaderCfg;
+
+ SysMgrConfiguration(const SysMgrConfiguration&) : l_pReaderCfg(NULL) {}
+ SysMgrConfiguration & operator = (const SysMgrConfiguration &);
+
+ private:
+ BOOL ParseBoolParameter(PCSTR f_value, BOOL f_default = FALSE) const;
+};
+
+#endif // SS_SM_CONFIG_H_ // NOLINT
diff --git a/systemservice/system_manager/server/include/ss_sm_default_paths.h b/systemservice/system_manager/server/include/ss_sm_default_paths.h
new file mode 100644
index 00000000..8ffafd98
--- /dev/null
+++ b/systemservice/system_manager/server/include/ss_sm_default_paths.h
@@ -0,0 +1,42 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for default path names.
+///
+///////////////////////////////////////////////////////////////////////////////
+#ifndef SYSTEM_MANAGER_SERVER_INCLUDE_SS_SM_DEFAULT_PATHS_H_
+#define SYSTEM_MANAGER_SERVER_INCLUDE_SS_SM_DEFAULT_PATHS_H_
+/*
+ * Environment variables
+ */
+const CHAR BaseDirPathEnvVariable[] = "BASE_DIR";
+const CHAR LaunchConfigFileNameEnvVariable[] = "APPS_CONFIG_FILENAME";
+const CHAR SMConfigDataFileNameEnvVariable[] = "SM_CONFIG_DATA_FILENAME";
+const CHAR UsingVMPlayerVariable[] = "USING_VM_PLAYER";
+
+/*
+ * Default paths to be used in case Environment variables are not set
+ */
+const CHAR DefaultBasePath[] = "";
+const CHAR DefaultBinaryPath[] = "/agl/bin/";
+const CHAR DefaultConfigFilesPath[] = "/usr/agl/conf/BS/ss/system_manager/rwdata/";
+const CHAR DefaultLaunchConfigFileName[] = "sm_launch.cfg";
+const CHAR DefaultSMConfigFileName[] = "gpf_ss_sm_config_data.cfg";
+
+#endif // SYSTEM_MANAGER_SERVER_INCLUDE_SS_SM_DEFAULT_PATHS_H_
+
diff --git a/systemservice/system_manager/server/include/ss_sm_dynamic_launch_table.h b/systemservice/system_manager/server/include/ss_sm_dynamic_launch_table.h
new file mode 100644
index 00000000..685b43bf
--- /dev/null
+++ b/systemservice/system_manager/server/include/ss_sm_dynamic_launch_table.h
@@ -0,0 +1,72 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for System Manager process launching.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_SM_DYNAMIC_LAUNCH_TABLE_H_ // NOLINT
+#define SS_SM_DYNAMIC_LAUNCH_TABLE_H_
+
+#include "ss_sm_dynamic_launcher.h"
+
+DynamicLaunchInfo g_arrDynamicLaunchTableCfg[] = {
+ // TUNER
+ { SS_SOURCE_FM,
+ (const PCHAR)"FM", (const PCHAR)"Audio", (const PCHAR)"Radio",
+ (const PCHAR)"HMI", (const PCHAR)"AviageTrigger", FALSE},
+ { SS_SOURCE_AM,
+ (const PCHAR)"AM", (const PCHAR)"Audio", (const PCHAR)"Radio",
+ (const PCHAR)"HMI", (const PCHAR)"AviageTrigger", FALSE},
+ { SS_SOURCE_FM_DAB,
+ (const PCHAR)"FM_DAB", (const PCHAR)"Audio", (const PCHAR)"Radio",
+ (const PCHAR)"HMI", (const PCHAR)"AviageTrigger", FALSE},
+ { SS_SOURCE_SDARS,
+ (const PCHAR)"SDARS", (const PCHAR)"Audio", (const PCHAR)"Radio",
+ (const PCHAR)"HMI", (const PCHAR)"AviageTrigger", FALSE},
+ // MEDIA
+ { SS_SOURCE_SD_CARD,
+ (const PCHAR)"SDCard", (const PCHAR)"Audio", (const PCHAR)"Multimedia",
+ (const PCHAR)"HMI", (const PCHAR)"AviageTrigger", TRUE},
+ { SS_SOURCE_MSC,
+ (const PCHAR)"MCS", (const PCHAR)"Audio", (const PCHAR)"Multimedia",
+ (const PCHAR)"HMI", (const PCHAR)"AviageTrigger", TRUE},
+ { SS_SOURCE_MTP, (const PCHAR)"MTP",
+ (const PCHAR)"Audio", (const PCHAR)"Multimedia", (const PCHAR)"HMI",
+ (const PCHAR)"AviageTrigger", TRUE},
+ { SS_SOURCE__CWORD57_,
+ (const PCHAR)"_CWORD57_", (const PCHAR)"Audio", (const PCHAR)"Multimedia",
+ (const PCHAR)"HMI", (const PCHAR)"AviageTrigger", TRUE},
+ { SS_SOURCE__CWORD73__APP,
+ (const PCHAR)"_CWORD57__APP", (const PCHAR)"Audio",
+ (const PCHAR)"Multimedia", (const PCHAR)"HMI", (const PCHAR)"AviageTrigger", TRUE},
+ { SS_SOURCE__CWORD73__VIDEO_MODE,
+ (const PCHAR)"_CWORD57__VM", (const PCHAR)"Audio",
+ (const PCHAR)"Multimedia", (const PCHAR)"HMI", (const PCHAR)"AviageTrigger", TRUE},
+ { SS_SOURCE_USB,
+ (const PCHAR)"USB", (const PCHAR)"Audio", (const PCHAR)"Multimedia",
+ (const PCHAR)"HMI", (const PCHAR)"AviageTrigger", TRUE},
+ { SS_SOURCE_DATA_CD,
+ (const PCHAR)"DATA_CD", (const PCHAR)"Audio",
+ (const PCHAR)"Multimedia", (const PCHAR)"HMI", (const PCHAR)"AviageTrigger", TRUE},
+ { SS_SOURCE_CD,
+ (const PCHAR)"AUDIO_CD", (const PCHAR)"Audio",
+ (const PCHAR)"Multimedia", (const PCHAR)"HMI", (const PCHAR)"AviageTrigger", TRUE},
+};
+
+#endif // SS_SM_DYNAMIC_LAUNCH_TABLE_H_ // NOLINT
diff --git a/systemservice/system_manager/server/include/ss_sm_dynamic_launcher.h b/systemservice/system_manager/server/include/ss_sm_dynamic_launcher.h
new file mode 100644
index 00000000..a6efb1fd
--- /dev/null
+++ b/systemservice/system_manager/server/include/ss_sm_dynamic_launcher.h
@@ -0,0 +1,111 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for System Manager process launching.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_SM_DYNAMIC_LAUNCHER_H_ // NOLINT
+#define SS_SM_DYNAMIC_LAUNCHER_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <system_service/interfaceunified_system_types.h>
+#include <vector>
+
+#include "ss_sm_config.h"
+
+using std::vector;
+
+
+typedef struct _tDynamicLaunchParams {
+ SS_SOURCE source;
+ const PCHAR source_name;
+ const PCHAR before_group_name;
+ const PCHAR start_group_name;
+ const PCHAR after_group_name;
+ const PCHAR aviage_trigger_name;
+ BOOL group_trigger;
+} DynamicLaunchInfo;
+
+
+class DynamicLaunchBase {
+ public:
+ DynamicLaunchBase();
+ virtual ~DynamicLaunchBase();
+ UI_32 get_id() const;
+ UI_32 advance_id();
+ UI_32 decrement_id();
+ BOOL is_begin();
+ BOOL is_end();
+ VOID to_begin();
+ VOID to_end();
+ VOID print_info();
+
+ protected:
+ typedef std::vector<UI_32> DynamicOrderedVector;
+ typedef DynamicOrderedVector::iterator DynamicOrderedIter;
+ DynamicOrderedVector m_vOrderedGroup;
+ DynamicOrderedIter m_iterOrderedGroup;
+};
+
+class DynamicModuleStart;
+
+class DynamicLauncher: public DynamicLaunchBase {
+ public:
+ DynamicLauncher();
+ virtual ~DynamicLauncher();
+ BOOL dynamic_launch_enabled() const;
+ VOID configure_dynamic_launch(const SS_SOURCE & source_type, // NOLINT
+ GroupLaunchMap & group_info, LaunchOrderedVector & order_info); // NOLINT
+ VOID copyDynOrderedVector(DynamicModuleStart &);
+
+ private:
+ // Disable class copy constructors
+ explicit DynamicLauncher(const DynamicLauncher& f_source)
+ : m_nLaunchGroupId(f_source.m_nLaunchGroupId)
+ , m_nLaunchBeforeGroupId(f_source.m_nLaunchBeforeGroupId)
+ , m_nLaunchAfterGroupId(f_source.m_nLaunchAfterGroupId)
+ , m_nAviageTriggerId(f_source.m_nAviageTriggerId)
+ , m_bDynamicLaunchEnabled(f_source.m_bDynamicLaunchEnabled)
+ , m_eSourceType(f_source.m_eSourceType) {}
+ DynamicLauncher & operator = (const DynamicLauncher &);
+
+ // helper methods..
+ DynamicLaunchInfo* get_dynamic_source_info(const SS_SOURCE& source_type, // NOLINT
+ BOOL& source_trigger, BOOL &is_aviage_required); // NOLINT
+ UI_32 get_id_using_group_name(PCSTR group_name, GroupLaunchMap& group_info); // NOLINT
+ VOID create_normal_launch_vector(GroupLaunchMap& group_info, LaunchOrderedVector& order_info); // NOLINT
+ BOOL is_inGroupLaunchMap(UI_32& id, GroupLaunchMap& group_info); // NOLINT
+
+ // Data Members
+ UI_32 m_nLaunchGroupId;
+ UI_32 m_nLaunchBeforeGroupId;
+ UI_32 m_nLaunchAfterGroupId;
+ UI_32 m_nAviageTriggerId;
+ BOOL m_bDynamicLaunchEnabled;
+ SS_SOURCE m_eSourceType;
+};
+
+class DynamicModuleStart: public DynamicLaunchBase {
+ public:
+ DynamicModuleStart();
+ virtual ~DynamicModuleStart();
+ VOID setGroupVector(DynamicOrderedVector&);
+};
+
+#endif // SS_SM_DYNAMIC_LAUNCHER_H_ // NOLINT
diff --git a/systemservice/system_manager/server/include/ss_sm_launch_configuration.h b/systemservice/system_manager/server/include/ss_sm_launch_configuration.h
new file mode 100644
index 00000000..72967144
--- /dev/null
+++ b/systemservice/system_manager/server/include/ss_sm_launch_configuration.h
@@ -0,0 +1,191 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for System Manager process launching.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_SM_LAUNCH_CONFIGURATION_H_ // NOLINT
+#define SS_SM_LAUNCH_CONFIGURATION_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <system_service/ss_services.h>
+#include <system_service/ss_client_names.h>
+
+typedef struct _DefaultModuleLaunchParams {
+ const PCHAR name;
+ const PCHAR binary_name;
+ const PCHAR arguments;
+ const PCHAR restart;
+ UI_32 priority;
+ BOOL critical;
+ UI_32 retry_cnt;
+ const PCHAR logging_msk_str;
+ BOOL is_start_required;
+ BOOL shutdown_critical;
+ UI_32 shutdown_wait_time;
+} DefaultModuleLaunchParams;
+
+typedef struct _DefaultGroupLaunchInfo {
+ const PCHAR name;
+ UI_32 id;
+ DefaultModuleLaunchParams *modules;
+} DefaultGroupLaunchInfo;
+
+
+#define prefix
+
+prefix DefaultModuleLaunchParams CoreModulesGroup[] = {
+ // Queue name binary_name arguments
+ {(const PCHAR)SERVICE_NS_SHARED_MEM,
+ (const PCHAR)"NS_SharedMem", (const PCHAR)"", (const PCHAR)"me",
+ 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0},
+ {(const PCHAR)SERVICE_NS_NPP, (const PCHAR)"NS_NPPService",
+ (const PCHAR)"", (const PCHAR)"me", 20, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", FALSE, TRUE, 15},
+ {(const PCHAR)SERVICE_LOGGER, (const PCHAR)SERVICE_LOGGER,
+ (const PCHAR)"", (const PCHAR)"me", 10, FALSE, 3, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0},
+ {(const PCHAR)SERVICE__CWORD69_, (const PCHAR)"_CWORD69_.exe",
+ (const PCHAR)"", (const PCHAR)"me", 10, FALSE, 3, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0},
+ {(const PCHAR)0, (const PCHAR)0,
+ (const PCHAR)0, (const PCHAR)0, 0, FALSE, 0, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0}
+};
+
+prefix DefaultModuleLaunchParams ShadowModulesGroup[] = {
+ // Queue name binary_name arguments
+ {(const PCHAR)SERVICE_PS_IPC, (const PCHAR)"PS_IPC",
+ (const PCHAR)"", (const PCHAR)"group", 50, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0},
+ {(const PCHAR)SERVICE_PSM_SHADOW, (const PCHAR)"PS_PSMShadow",
+ (const PCHAR)"", (const PCHAR)"group", 12, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_KEY_HANDLER, (const PCHAR)"PS_KeyHandler",
+ (const PCHAR)"", (const PCHAR)"group", 12, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_IPC_MP_SHADOW, (const PCHAR)"PS_IPC_MP_Shadow",
+ (const PCHAR)"", (const PCHAR)"group", 20, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)0, (const PCHAR)0,
+ (const PCHAR)0, (const PCHAR)0, 0, FALSE, 0, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0}
+};
+
+prefix DefaultModuleLaunchParams SystemModulesGroup[] = {
+ {(const PCHAR)SERVICE_POWER, (const PCHAR)SERVICE_POWER,
+ (const PCHAR)"", (const PCHAR)"me", 12, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SS_DEV_DETECT_SRV, (const PCHAR)SS_DEV_DETECT_SRV,
+ (const PCHAR)"", (const PCHAR)"me", 12, FALSE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SS_PLM_SERVICE, (const PCHAR)SS_PLM_SERVICE,
+ (const PCHAR)"", (const PCHAR)"me", 12, FALSE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)0, (const PCHAR)0,
+ (const PCHAR)0, (const PCHAR)0, 0, FALSE, 0, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0}
+};
+
+prefix DefaultModuleLaunchParams AudioModulesGroup[] = {
+ {(const PCHAR)SERVICE_AS_AUDIO, (const PCHAR)"AS_AudioService",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_AS_MODE, (const PCHAR)"AS_ModeService",
+ (const PCHAR)"", (const PCHAR)"me", 10, FALSE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)0, (const PCHAR)0,
+ (const PCHAR)0, (const PCHAR)0, 0, FALSE, 0, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0}
+};
+
+prefix DefaultModuleLaunchParams RadioModulesGroup[] = {
+ {(const PCHAR)SERVICE_TUNER, (const PCHAR)"Radio",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_DAB, (const PCHAR)"Master_Tuner",
+ (const PCHAR)"", (const PCHAR)"me", 10, FALSE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_SDARS, (const PCHAR)"Ext_SDARS_Service",
+ (const PCHAR)"", (const PCHAR)"me", 10, FALSE, 3,
+ (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)0, (const PCHAR)0,
+ (const PCHAR)0, (const PCHAR)0, 0, FALSE, 0, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0}
+};
+
+prefix DefaultModuleLaunchParams MultimediaModulesGroup[] = {
+ {(const PCHAR)SERVICE_MM_ICD, (const PCHAR)"MM_ICDService",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_MM_MEDIA, (const PCHAR)"MediaService",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)0, (const PCHAR)0,
+ (const PCHAR)0, (const PCHAR)0, 0, FALSE, 0, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0}
+};
+
+prefix DefaultModuleLaunchParams HMIModulesGroup[] = {
+ {(const PCHAR)SERVICE_HMI, (const PCHAR)"GtfStartup",
+ (const PCHAR)"/eb/gtf_5.2.1/models/PastModel004/gtfStartup.cfg", (const PCHAR)"me",
+ 13, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0},
+ {(const PCHAR)SERVICE_HMI__CWORD77_, (const PCHAR)"HMI__CWORD77_",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_HMI__CWORD46_, (const PCHAR)"HMI__CWORD46_Service", (const PCHAR)"",
+ (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)0, (const PCHAR)0, (const PCHAR)0,
+ (const PCHAR)0, 0, FALSE, 0, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0}
+};
+
+prefix DefaultModuleLaunchParams NavigationModulesGroup[] = {
+ {(const PCHAR)SERVICE_NAV_LOC, (const PCHAR)"NAV_LocationService", (const PCHAR)"", (const PCHAR)"me",
+ 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_NAV, (const PCHAR)"NAV_NavigationService", (const PCHAR)"", (const PCHAR)"me",
+ 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)0, (const PCHAR)0, (const PCHAR)0, (const PCHAR)0,
+ 0, FALSE, 0, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0}
+};
+
+prefix DefaultModuleLaunchParams SoftwareUpdateModulesGroup[] = {
+ {(const PCHAR)SERVICE_SOFTWAREUPDATE, (const PCHAR)"SS_SoftwareUpdateService",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_PS_SWDL_SHADOW, (const PCHAR)"PS_SoftwareUpdateShadow",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)0, (const PCHAR)0,
+ (const PCHAR)0, (const PCHAR)0, 0, FALSE, 0, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0}
+};
+
+prefix DefaultModuleLaunchParams NetworkingModulesGroup[] = {
+ {(const PCHAR)SERVICE__CWORD51__BT, (const PCHAR)"_CWORD51__BT.exe",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_NW_BT, (const PCHAR)"NW_BluetoothService",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_NW_CONNECTION, (const PCHAR)"NW_ConnectionService",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_NW_PHONE, (const PCHAR)"NW_PhoneService",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_NW_PHONE_BOOK, (const PCHAR)"NW_PhoneBookService",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)SERVICE_NW_MESSAGING, (const PCHAR)"NW_MessagingService",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)0, (const PCHAR)0,
+ (const PCHAR)0, (const PCHAR)0, 0, FALSE, 0, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0}
+};
+
+prefix DefaultModuleLaunchParams BrowserModulesGroup[] = {
+ {(const PCHAR)SERVICE_BR_BROWSER, (const PCHAR)"BR_BrowserService",
+ (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0},
+ {(const PCHAR)0, (const PCHAR)0,
+ (const PCHAR)0, (const PCHAR)0, 0, FALSE, 0, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0}
+};
+
+prefix DefaultGroupLaunchInfo g_arrLaunchTable[] = {
+ {(const PCHAR)"CoreModules", 1, CoreModulesGroup },
+ {(const PCHAR)"ShadowModules", 2, ShadowModulesGroup },
+ {(const PCHAR)"SystemModules", 3, SystemModulesGroup },
+ {(const PCHAR)"Audio", 4, AudioModulesGroup },
+ {(const PCHAR)"Radio", 5, RadioModulesGroup },
+ {(const PCHAR)"Multimedia", 6, MultimediaModulesGroup },
+ {(const PCHAR)"HMI", 7, HMIModulesGroup },
+ {(const PCHAR)"Navigation", 8, NavigationModulesGroup },
+ {(const PCHAR)"SoftwareUpdate", 9, SoftwareUpdateModulesGroup },
+ {(const PCHAR)"Networking", 10, NetworkingModulesGroup },
+ {(const PCHAR)"Browser", 11, BrowserModulesGroup },
+};
+
+#endif // SS_SM_LAUNCH_CONFIGURATION_H_ // NOLINT
diff --git a/systemservice/system_manager/server/include/ss_sm_signals.h b/systemservice/system_manager/server/include/ss_sm_signals.h
new file mode 100644
index 00000000..4c52b329
--- /dev/null
+++ b/systemservice/system_manager/server/include/ss_sm_signals.h
@@ -0,0 +1,32 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file supports process termination.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_SM_SIGNALS_H_ // NOLINT
+#define SS_SM_SIGNALS_H_
+
+#include <signal.h>
+
+#define SS_SM_ABORT_SIGNAL (SIGABRT)
+#define SS_SM_KILL_SIGNAL (SIGKILL)
+#define SS_SM_TERMINATE_SIGNAL (SIGTERM)
+
+#endif // SS_SM_SIGNALS_H_ // NOLINT
diff --git a/systemservice/system_manager/server/include/ss_sm_systemmanagerlog.h b/systemservice/system_manager/server/include/ss_sm_systemmanagerlog.h
new file mode 100644
index 00000000..04997510
--- /dev/null
+++ b/systemservice/system_manager/server/include/ss_sm_systemmanagerlog.h
@@ -0,0 +1,91 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file supports agl application logging.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef __SS_SM_SYSTEMMANAGERLOG_H__ // NOLINT
+#define __SS_SM_SYSTEMMANAGERLOG_H__
+
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10)
+#define ZONE_FUNC ZONEMASK(11)
+#define ZONE_MEM ZONEMASK(12)
+#define ZONE_FUNC_IPC ZONEMASK(13)
+#define ZONE_APP_LAUNCH ZONEMASK(14)
+#define ZONE_ACTIVE_INDEX ZONEMASK(15)
+#define ZONE_CONFIG_TABLE ZONEMASK(16)
+#define ZONE_FUNC_ARGS ZONEMASK(17)
+#define ZONE_LOG_FILE ZONEMASK(18)
+#define ZONE_MSG ZONEMASK(19)
+#define ZONE_TIMER ZONEMASK(20)
+#define ZONE_LAUNCH_TIME ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_UNUSED ZONEMASK(23)
+#define ZONE_PERIODIC_FUNC ZONEMASK(24)
+#define ZONE_PERIODIC_INFO ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_DYNAMIC_LNCH ZONEMASK(27)
+#define ZONE_STATE ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29)
+
+#define ZONE_SYSLOG ZONE_SYSTEMDATA
+#define ZONE_PERFORM ZONE_PERFORMANCE
+#define ZONE_PROC_LAUNCH_INFO ZONE_FUNC
+
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 "Ipc Function"
+#define ZONE_TEXT_14 "Active Index"
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 "Config Table"
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 "Ipc Info"
+#define ZONE_TEXT_29 "Info"
+// These ARE RESERVED AND SHOULDN'T BE TOUCHED
+// USE THEM WHEN REALLY NEEDED!!!!!
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+#define ZONE_WARN ZONEMASK(30)
+#define ZONE_ERR ZONEMASK(31)
+#define ALL_ZONES_BUT_IPC_INFO 0xEFFFFFFF
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LMSGQ) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_WARN, ZONE_ERR, ZONE_STATE, ZONE_SYSLOG, ZONE_PERFORM, ZONE_NS_WAR, ZONE_NS_ERR
+#endif // FRAMEWORKUNIFIEDLOGAPPZONES
+
+#endif // __SS_SM_SYSTEMMANAGERLOG_H__ // NOLINT
diff --git a/systemservice/system_manager/server/include/ss_sm_version.h b/systemservice/system_manager/server/include/ss_sm_version.h
new file mode 100644
index 00000000..ea0a7750
--- /dev/null
+++ b/systemservice/system_manager/server/include/ss_sm_version.h
@@ -0,0 +1,39 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for module version management.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_SM_VERSION_H_ // NOLINT
+#define SS_SM_VERSION_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <system_service/ss_system_manager_protocol.h>
+#include "ss_sm_process_launcher_protocol.h"
+
+class CSMVersion {
+ public:
+ CSMVersion();
+ ~CSMVersion();
+ EFrameworkunifiedStatus get_version(SS_VersionNumberType& f_VersionNumber); // NOLINT
+ EFrameworkunifiedStatus get_build_info(std::string& f_buildInfoStr); // NOLINT
+
+ private:
+};
+#endif // SS_SM_VERSION_H_ // NOLINT
diff --git a/systemservice/system_manager/server/include/ss_system_manager.h b/systemservice/system_manager/server/include/ss_system_manager.h
new file mode 100644
index 00000000..12d5bad0
--- /dev/null
+++ b/systemservice/system_manager/server/include/ss_system_manager.h
@@ -0,0 +1,760 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for System Manager business logic.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef __SS_SYSTEM_MANAGER_H__ // NOLINT
+#define __SS_SYSTEM_MANAGER_H__
+
+#include <system_service/ss_heartbeat_service_protocol.h>
+#include <system_service/ss_system_manager_if.h>
+#include <system_service/ss_error_event_common_local.h>
+#include <system_service/ss_system_timer.h>
+#include <crashdetector/ss_crashdetector.h>
+#include <system_service/ss_system_manager_protocol.h>
+#include <system_service/ss_power_service_protocol.h>
+#include <heartbeat/ss_hb_if.h>
+#include <other_service/PosixBasedOS001ClockCycleApi.h>
+#include <system_service/ss_string_maps.h>
+#include <system_service/ss_templates.h>
+#include <system_service/ss_system_manager_conf.h>
+#include <system_service/ss_system_manager_protocol_local.h>
+#include <system_service/ss_logger_store_logs.h>
+#include <native_service/ns_logger_if.h>
+#include <native_service/frameworkunified_types.h>
+#include <power_hal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <pthread.h>
+#include <inttypes.h>
+#include <map>
+#include <string>
+#include <vector>
+#include <queue>
+#include <sstream>
+#include <set>
+#include <list>
+#include <utility>
+
+#include "ss_sm_config.h"
+#include "ss_sm_systemmanagerlog.h"
+#include "ss_system_thread_info.h"
+#include "ss_system_memory_monitor.h"
+#include "ss_sm_dynamic_launcher.h"
+
+static_assert((SS_SM_PROG_UPDATE_STATE_NONE == PWR_PROGUPDATE_STATE_NONE),
+ "SS_SM_PROG_UPDATE_STATE_NONE should be equal to "
+ "PWR_PROGUPDATE_STATE_NONE");
+static_assert((SS_SM_PROG_UPDATE_STATE_UPDATED == PWR_PROGUPDATE_STATE_UPDATED),
+ "SS_SM_PROG_UPDATE_STATE_UPDATED should be equal to "
+ "PWR_PROGUPDATE_STATE_UPDATED");
+static_assert((SS_SM_PROG_UPDATE_STATE_MAP_UPDATED ==
+ PWR_PROGUPDATE_STATE_MAP_UPDATED),
+ "SS_SM_PROG_UPDATE_STATE_MAP_UPDATED should be equal to "
+ "PWR_PROGUPDATE_STATE_MAP_UPDATED");
+static_assert((SS_SM_PROG_UPDATE_STATE_MAPDIFF_UPDATED ==
+ PWR_PROGUPDATE_STATE_MAPDIFF_UPDATED),
+ "SS_SM_PROG_UPDATE_STATE_MAPDIFF_UPDATED should be equal to "
+ "PWR_PROGUPDATE_STATE_MAPDIFF_UPDATED");
+
+#define SM_SHUTDOWN_COMPLETE_MONITOR_TIMEOUT 60
+
+typedef enum {
+ eSM_TIMER_GROUP_MONITOR = 0x00
+ , eSM_TIMER_PROCESS_LAUNCH_MONITOR
+ , eSM_TIMER_HEARTBEAT_MONITOR
+ , eSM_TIMER_PROCESSLAUNCHER_MONITOR
+ , eSM_TIMER_CLIENT_START_MONITOR
+ , eSM_TIMER_NPP_STATUS_CHECK_MONITOR
+ , eSM_TIMER__CWORD56__HEARTBEAT_RESPONSE
+ , eSM_TIMER_LAUNCH_GROUP_TRIGGER_PROC_RESP_TIMER
+ , eSM_TIMER_GROUP_LAUNCH_WAIT_TIMER
+ , eSM_TIMER_MODULE_CONNECT_WAIT_TIMER
+ , eSM_TIMER_START_RESP_MONITOR_WAIT_TIMER
+ , eSM_TIMER_SHUTDOWN_COMPLETE_MONITOR
+ , eSM_TIMER_CLIENT_STOP_MONITOR
+ , eSM_TIMERS_END
+} ESMTimerIDs;
+
+typedef enum {
+ eSM_ERROR_EVENT_TIMER_LOGGER_START_REQ
+ , eSM_ERROR_EVENT_TIMER_DEBUG_DUMP_RSPN
+ , eSM_ERROR_EVENT_TIMER_BOOT_MICRO_LOG_RSPN
+ , eSM_ERROR_EVENT_TIMER_CORE_FILE_POLL
+ , eSM_ERROR_EVENT_TIMER_END
+} ESMErrorEventTimers;
+
+typedef enum {
+ eErrorEventResetTypeNone = 0,
+ eErrorEventResetTypeHard
+} EErrorEventResetType;
+
+typedef enum _ESMInternalProtocol {
+ SS_SM_SendTriggerToSelf = SS_SM_PROTOCOL_INTERFACE_END ///< System Manager to System Manager
+} ESMInternalProtocol;
+
+typedef enum _SS_SMGroupHirarchy {
+ SS_SM_INVALID_GROUP = 0
+ , SS_SM_INITIAL_GROUP
+ , SS_SM_SECOND_GROUP
+ , SS_SM_THIRD_GROUP
+} SS_SMGroupHirarchy;
+
+typedef enum _SS_SMModuleState {
+ SS_SM_READY_TO_LAUNCH_APP = 0x00
+ , SS_SM_APPS_LAUNCH_IN_PROGRESS
+ , SS_SM_APPS_LAUNCHED_READY_TO_START
+ , SS_SM_APPS_START_IN_PROGRESS
+ , SS_SM_APPS_START_COMPLETE
+ , SS_SM_APPS_STOPPING_AT__CWORD56__REQ
+ , SS_SM_APPS_STOPPING_AT_INTERNAL_REQ
+ , SS_SM_WAITING_FOR_CRITICAL_APPS_AT__CWORD56__REQ
+ , SS_SM_WAITING_FOR_CRITICAL_APPS_AT_INTERNAL_REQ
+ , SS_SM_APPS_PRE_START_IN_PROGRESS
+ , SS_SM_APPS_PRE_STOP_IN_PROGRESS
+ , SS_SM_APPS_PRE_RUN_COMPLETE
+ , SS_SM_APPS_BACKGROUND_START_IN_PROGRESS
+ , SS_SM_APPS_BACKGROUND_STOP_IN_PROGRESS
+ , SS_SM_APPS_BACKGROUND_RUN_COMPLETE
+} SS_SMModuleState;
+
+typedef struct _SMProcessExitInfo {
+ _SMProcessExitInfo() {
+ this->pid = 0;
+ this->exitValue = 0;
+ this->signalNumber = 0;
+ this->binaryFileName[0] = '\0';
+ }
+
+ UI_32 pid;
+ SI_32 exitValue;
+ SI_32 signalNumber;
+ CHAR binaryFileName[MAX_PATH_LENGTH];
+} SMProcessExitInfo;
+
+typedef struct _SMLoggingInfo { // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ _SMLoggingInfo() {
+ this->pid = 0;
+ this->exitValue = 0;
+ this->signalNumber = 0;
+ this->binaryFileName[0] = '\0';
+ this->messageStr = "";
+ this->suffixStr = "";
+ this->path = "";
+ this->resetReason = e_SS_SM_CPU_RESET_REASON_INVALID;
+ }
+
+ UI_32 pid;
+ SI_32 exitValue;
+ SI_32 signalNumber;
+ CHAR binaryFileName[MAX_PATH_LENGTH];
+ std::string messageStr;
+ std::string suffixStr;
+ std::string path;
+ ESMCpuResetReason resetReason;
+} SMLoggingInfo;
+
+struct ERROR_EVENT_INFO { // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ ERROR_EVENT_INFO() :
+ m_eventEnqueueTimeStamp(""),
+ m_moduleQueueName(""),
+ m_eventType(eErrorEventTypeMaxValue),
+ m_prio(eErrorEventPrioDefault),
+ m_uniqueCycles(ClockCycle()), // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ m_errorEventResetType(eErrorEventResetTypeNone) { // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length)
+ }
+
+ std::string m_eventEnqueueTimeStamp;
+ std::string m_moduleQueueName;
+ EErrorEventType m_eventType;
+ SMLoggingInfo m_loggingInfo;
+ EErrorEventPrio m_prio;
+ UI_64 m_uniqueCycles;
+ EErrorEventResetType m_errorEventResetType;
+};
+
+struct ERROR_EVENT_COMPARE {
+ bool operator() (const ERROR_EVENT_INFO& lhs,
+ const ERROR_EVENT_INFO& rhs) const {
+ if ((eErrorEventPrioDefault == lhs.m_prio) &&
+ (eErrorEventPrioDefault == rhs.m_prio)) {
+ return (lhs.m_uniqueCycles < rhs.m_uniqueCycles);
+ } else {
+ return (lhs.m_prio > rhs.m_prio);
+ }
+ }
+};
+
+typedef std::set<ERROR_EVENT_INFO, ERROR_EVENT_COMPARE> ERROR_EVENT_QUEUE;
+typedef ERROR_EVENT_QUEUE::iterator ERROR_EVENT_QUEUE_ITER;
+typedef std::pair<ERROR_EVENT_QUEUE_ITER, BOOL> ERROR_EVENT_QUEUE_RET;
+
+typedef EFrameworkunifiedStatus (*HndlrCb)(HANDLE hApp);
+typedef EFrameworkunifiedStatus (*FncCbType2)(HANDLE hApp, UI_32 f_UI_32);
+typedef BOOL (*FncCbType3)(UI_32 f_UI_32);
+
+typedef std::pair<SS_SystemManagerProtocol, Pwr_ServiceSetInterface> SM_POWER_EVENT_INFO;
+typedef std::queue<SM_POWER_EVENT_INFO> SM_POWER_EVENT_QUEUE;
+
+typedef struct {
+ std::string m_cmd;
+ UI_64 m_time;
+ std::string m_sender;
+} Ts_cmdHist;
+
+typedef std::list<std::string> ErrorGroupList;
+typedef ErrorGroupList::iterator ErrorGroupListIter;
+
+typedef std::vector<Ts_cmdHist> cmdHist;
+typedef cmdHist::iterator cmdHistIter;
+
+typedef std::vector<std::string> HBList;
+typedef HBList::iterator HBListIter;
+
+class CVersionNumInfo {
+ public:
+ CVersionNumInfo() : m_VersionNumber(0), m_eSystemmanagerStatus(eFrameworkunifiedStatusErrOther) {}
+ CVersionNumInfo(SS_VersionNumberType f_vn, EFrameworkunifiedStatus f_eStatus)
+ : m_VersionNumber(f_vn), m_eSystemmanagerStatus(f_eStatus) {}
+
+ // System Manager's local data store; write once on initialization,
+ // read as needed at clients' request
+ SS_VersionNumberType m_VersionNumber;
+ EFrameworkunifiedStatus m_eSystemmanagerStatus; // Validity / status of version number
+};
+
+#define SS_SM_RELAUNCH_NO_LIMIT -1
+typedef struct _PreLaunchModuleParams {
+ _PreLaunchModuleParams() {
+ this->LaunchFunc = NULL;
+ this->name = "";
+ this->binaryFileName = "";
+ this->critical = FALSE;
+ this->relaunchLimit = 0;
+ this->pid = -1;
+ this->relaunchCount = 0;
+ }
+
+ int (*LaunchFunc)(); // Launching function
+ std::string name; // Process name
+ std::string binaryFileName; // Binary file name
+ BOOL critical; // Reboot attribute
+ int relaunchLimit; // Maximum number of Relaunch
+ int pid; // pid
+ int relaunchCount; // Count of Relaunching
+} PreLaunchModuleParams;
+
+typedef std::list<PreLaunchModuleParams> PreLaunchModuleList;
+typedef PreLaunchModuleList::iterator PreLaunchModuleListIter;
+
+typedef struct _GroupRelaunchModuleParams {
+ _GroupRelaunchModuleParams() {
+ this->name = "";
+ this->bIsKilled = FALSE;
+ }
+
+ std::string name; // Process name
+ BOOL bIsKilled; // Flag indicates while forced quit process
+} GroupRelaunchModuleParams;
+
+typedef std::list<GroupRelaunchModuleParams> GroupRelaunchModuleList;
+typedef GroupRelaunchModuleList::iterator GroupRelaunchModuleListIter;
+
+
+class CSystemManager {
+ public:
+ static std::string m_bootOpt; // BOOT OPTION
+
+ CSystemManager();
+ virtual ~CSystemManager();
+
+ static CSystemManager & GetInstance();
+ EFrameworkunifiedStatus Initialize(HANDLE hApp);
+ void Initialize_memory(HANDLE hApp, bool* l_isInitFail, EFrameworkunifiedStatus* l_eStatus, BOOL isIllReset);
+ void Initialize_callbacks(HANDLE hApp, bool *l_isInitFail, EFrameworkunifiedStatus *l_eStatus);
+ /// < Process Launcher Thread Callbacks
+ EFrameworkunifiedStatus OnModuleLaunchResponse(HANDLE hApp);
+ EFrameworkunifiedStatus OnTerminateModuleResponse(HANDLE hApp);
+ EFrameworkunifiedStatus OnReLaunchModuleResponse(HANDLE hApp);
+ EFrameworkunifiedStatus PerformModuleLaunchRespProcessing(HANDLE hApp,
+ GroupLaunchMapIter & f_GroupIter, // NOLINT
+ ModuleLaunchListIter & f_ModuleIter, // NOLINT
+ PCSTR p_sPPD_tag);
+ EFrameworkunifiedStatus OnModuleStatusResponse(HANDLE hApp);
+ EFrameworkunifiedStatus OnGroupLaunchTimerExpiry(HANDLE hApp);
+ EFrameworkunifiedStatus OnLaunchGroup(HANDLE hApp);
+ EFrameworkunifiedStatus OnLaunchGroupSelfTrigger(HANDLE hApp);
+ EFrameworkunifiedStatus OnProcessLaunchTimerExpiry(HANDLE hApp);
+ EFrameworkunifiedStatus OnHeartBeatMonitorTimerExpiry(HANDLE hApp);
+ EFrameworkunifiedStatus OnProcessLaunchMonitorTimerExpiry(HANDLE hApp);
+ EFrameworkunifiedStatus OnHeartBeatThreadHeartbeatResponse(HANDLE hApp);
+ EFrameworkunifiedStatus OnCheckAvailResponse(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnProcessLauncherThreadHeartbeatResponse(HANDLE hApp);
+ EFrameworkunifiedStatus OnClientStartMonitorTimerExpiry(HANDLE hApp);
+ EFrameworkunifiedStatus OnClientStopMonitorTimerExpiry(HANDLE hApp);
+ EFrameworkunifiedStatus OnNPPStatusCheckMonitorTimerExpiry(HANDLE hApp);
+ EFrameworkunifiedStatus OnPowerServiceAvailableNotify(HANDLE hApp);
+ EFrameworkunifiedStatus OnLVI1Notify(HANDLE hApp);
+ EFrameworkunifiedStatus OnLVI2Notify(HANDLE hApp);
+
+ EFrameworkunifiedStatus OnModuleStartCompleteResponse(HANDLE hApp); /// Process start complete from client
+ EFrameworkunifiedStatus OnModuleStopCompleteResponse(HANDLE hApp); /// Process stop Complete from client
+ EFrameworkunifiedStatus OnGetStartExtInfo(HANDLE hApp);
+ EFrameworkunifiedStatus OnGetStopExtInfo(HANDLE hApp);
+ EFrameworkunifiedStatus OnModuleStopCompleteNotification(HANDLE hApp);
+ EFrameworkunifiedStatus ProcessModuleStopCompleteResponse(HANDLE hApp,
+ PCSTR f_moduleName);
+ EFrameworkunifiedStatus ModuleCompleteResponse(HANDLE hApp,
+ ModuleLaunchListIter f_ModuleListIter,
+ SMModuleState f_moduleState,
+ FncCbType3 f_isGroupDoneFnc,
+ FncCbType2 f_groupDoneFnc,
+ PCSTR f_sCompleteTypeText);
+
+ EFrameworkunifiedStatus ProcessGroupOnModuleStopResponse(HANDLE hApp, UI_32 f_groupID);
+
+
+
+ EFrameworkunifiedStatus OnLaunchGroupTriggerProcessResponseTimerExpiry(HANDLE hApp);
+
+ EFrameworkunifiedStatus OnNppStopComplete(HANDLE hApp); /// Process stop Complete from NPPService
+ EFrameworkunifiedStatus OnOpenSession(HANDLE hApp); /// Process open session request
+ EFrameworkunifiedStatus OnCloseSession(HANDLE hApp); /// Process close session acknowledgment
+
+ EFrameworkunifiedStatus CloseApplication(HANDLE hApp);
+ EFrameworkunifiedStatus OnGetAppInfo(HANDLE hApp);
+
+ /// < Heartbeat Thread Callbacks
+ EFrameworkunifiedStatus OnHeartBeatErrorReport(HANDLE hApp);
+
+ EFrameworkunifiedStatus OnCurrentSMStateQuery(HANDLE hApp);
+
+ EFrameworkunifiedStatus OnNPPReadyStatusCallback(HANDLE hApp);
+ EFrameworkunifiedStatus OnNPPReadyEventCallback(HANDLE hApp);
+ EFrameworkunifiedStatus OnWakeupCallback(HANDLE hApp);
+ EFrameworkunifiedStatus OnPowerRequestCallback(HANDLE hApp);
+ EFrameworkunifiedStatus OnBackupMgrAvailCallback(HANDLE hApp);
+ EFrameworkunifiedStatus OnShutdownModulesRequest(HANDLE hApp);
+ EFrameworkunifiedStatus OnSystemModeInfoRequest(HANDLE hApp);
+ EFrameworkunifiedStatus ClearDramBackupInfo(HANDLE hApp);
+ EFrameworkunifiedStatus OnInitCompReportCallback(HANDLE hApp);
+ EFrameworkunifiedStatus SetEnvVariableForVupMode(BOOL bIsVupMode);
+ static int CreateRtUsb();
+ EFrameworkunifiedStatus SecureChipOff();
+ EFrameworkunifiedStatus CallStopCompleteHandler(HANDLE hApp, BOOL bISDetectTimeout = FALSE);
+
+ EFrameworkunifiedStatus On_CWORD56_HeartBeatRequest(HANDLE hApp);
+ EFrameworkunifiedStatus On_CWORD56_HeartBeatResponseIntervalTimerExpiry(HANDLE hApp);
+ EFrameworkunifiedStatus OnGroupLaunchWaitTimeout(HANDLE hApp);
+ EFrameworkunifiedStatus OnModuleConnectWaitTimeout(HANDLE hApp);
+ EFrameworkunifiedStatus OnStartRespMonitorTimeout(HANDLE hApp);
+ EFrameworkunifiedStatus OnShutdownCompleteMonitorTimeout(HANDLE hApp);
+ EFrameworkunifiedStatus PerformCpuReset(HANDLE hApp, ESMCpuResetReason f_eSmCpuResetReason, std::string f_messageStr = ""); // NOLINT
+ EFrameworkunifiedStatus OnCpuResetRequest(HANDLE hApp);
+ EFrameworkunifiedStatus OnSetDataResetModeRequest(HANDLE hApp);
+ EFrameworkunifiedStatus OnSetProgUpdateStateRequest(HANDLE hApp);
+ EFrameworkunifiedStatus OnLaunchGroupTriggerProcessResponse(HANDLE hApp);
+ EFrameworkunifiedStatus OnSetNextWakeupTypeRequest(HANDLE hApp);
+
+ bool GetDramPowerStatusInfo(const HANDLE h_app);
+ bool GetDramStoreStatusInfo(const HANDLE h_app);
+ bool GetSyscomPowerStatusInfo(const HANDLE h_app);
+ //
+ // Start Confirmation, Get _CWORD56_ Version callback functions
+ EFrameworkunifiedStatus OnSetStartupConfirmationDataRequest(HANDLE hApp);
+
+ void SystemManagerDebugDump(HANDLE hApp);
+
+
+ private:
+ CThreadInfo m_hHeartbeatThread; // Handle to Heartbeat Thread
+ CThreadInfo m_hProcLauncherThread; // Handle to Process Launcher Thread
+ UI_32 m_SystemLaunchProgress; // Launch Progress of system
+ TimerCtrl * m_GroupLaunchTimer; // Launch Monitor Timer
+ UI_32 m_aTimerIDs[eSM_TIMERS_END]; // TimerIDs returned by create timer
+ PreLaunchModuleList m_PreLaunchModuleList; // List of modules that shuuld be launched preliminarily.
+ GroupRelaunchModuleList m_GroupRelaunchModuleList; // List of modules that need to relaunch
+ UI_32 m_GroupRelaunchCount; // Count for group relaunch
+ UI_32 m_GroupRelaunchLimit; // Limit for group relaunch
+ GroupLaunchMap m_MapProclaunchGrps; // Map of modules that should be launched.
+ ProcessNameMap m_MapProcNames; // Map of module binary names to queue names.
+ HANDLE m_hPowerServiceSession;
+ UI_32 m_ActiveGroupId; // Modules of Group to whom START/STOP has been sent
+ wakeInfo m_Wake; // WakeUp data from power
+ EPWR_WAKEUP_FACTOR_TYPE m_StartUpReason; // System Manager preserve start up reason
+ ESMDataResetModeInfo m_DataResetMode; // Data Reset Mode
+ SMProgUpdateState m_ProgUpdateState; // ProgUpdate State
+ ESMNextWakeupType m_NextWakeupType; // Next Progupdate State
+ ESMDramBackupStatus m_DramBackupStatus; // Dram Backup Status
+ BOOL m_isIlgReset; // Error Detected by SYS-ucon
+ ESMResetStatus m_ResetStatus; // Reset Status
+ UI_32 m_ResetCount; // Reset Count
+ T_SS_SM_INIT_HOOK_OUT_PARAM m_productCustomPrm; // Product customized parameters
+
+ SS_SMModuleState m_SMCurrentState; // Current state of System Manager
+ UI_32 m_MaxShutdownTime; // Calculate Max shutdown time based on info from xml
+ UI_32 m_NbrDebugDumpRspnRecv; // Total number of debug dump responses received.
+ BOOL m_isRcvModeInfo;
+ SystemModeInfo m_SystemModeInfo; // System Mode Info, SM to read data from persistent file at start
+ SS_String m_BinaryFilesPath; // Store binary files path
+ SS_String m_ConfigFilesPath; // Store config files path
+ ConfigurationData m_SMConfig; // Configuration Data of System Manager and its threads
+ HndlrCb m_pfStopCompleteHandler;
+ CVersionNumInfo m_VersionNumberStruct;
+ SS_String m_BuildInfoStr;
+
+ BOOL m_isRstPending;
+ TSystemManagerCpuResetInfo m_rstPendingInfo;
+
+ SM_POWER_EVENT_QUEUE m_dqDeferMsg;
+ BOOL m_UsingVMPlayer; // Running on a VMPlayer ?
+ UI_32 NVM_VALID_SIGNATURE;
+ StartupConfirmationMsgStrut m_startUpConfirmationMsg;
+ EPWR_USER_MODE_TYPE m_lastUserMode;
+ EPWR_SHUTDOWN_TRIGGER_TYPE m_shutdownTrigger; // Set from Shutdown_Request
+ // msg from _CWORD56_, sent to
+ // all modules as part of
+ // SS_SM_STOP msg.
+ BOOL m_isImmediateReset;
+ BOOL m_isImmResetReq;
+ BOOL m_needReNotifyStartPrm;
+ CHAR *m_pVarCodeStr;
+ GroupLaunchMapIter m_SSLGroupLaunchMapIterator;
+ ModuleLaunchListIter m_ModuleLaunchListIter;
+ BOOL m_bIsNPP_ServicesStarted;
+ BOOL m_bIsBackupAvail;
+ //
+ DynamicLauncher m_oSystemLauncher;
+ DynamicModuleStart m_SystemStarter;
+ //
+ BOOL m_NPPStopSent;
+ ePwrServiceUserModeChangeReasonType m_userModeChangeReason;
+
+ HBList m_HBList;
+
+ cmdHist m__CWORD56_CmdHist;
+ cmdHistIter m__CWORD56_HistIter;
+ cmdHist m_SMCmdHist;
+ cmdHistIter m_SMHistIter;
+ cmdHist m_TimerCmdHist;
+ cmdHistIter m_TimerHistIter;
+ cmdHist m_PubCmdHist;
+ cmdHistIter m_PubHistIter;
+ cmdHist m_ErrHist;
+ cmdHistIter m_ErrHistIter;
+
+ pthread_mutex_t sm_hist_mutex;
+
+ bool m_InitialBoot;
+
+ PsmFactorT m_ResetFactor; // reset(start-up) factor.
+
+ void SetCmdHist(std::string cmd, cmdHist &hist, cmdHistIter &it, std::string sender); // NOLINT
+
+ // ILGRST or ACCOFFON Logging
+ bool StoreDebugLogs(const HANDLE h_app, SS_STORELOGS_OPE_TYPE);
+
+ UI_32 InProgressStateToSendMsg() const;
+ SMModuleState InProgressStateToState() const;
+
+ //************************************************************************
+ // Error Event Logging *
+ //
+ int m_ClProcessSigFd;
+ CSysMemoryMonitor m_SysMemMonitor;
+
+ UI_32 m_FreeMemAvailable;
+ off_t m_coreFileSizeBytes;
+ THbReportData m_HBReport;
+ eSMBootMicroResetReason m_BootMicroResetReason;
+ BOOL m_errorEventQueueLocked;
+ ERROR_EVENT_QUEUE m_errorEventQueue;
+ Timer m_errorEventTimers[eSM_ERROR_EVENT_TIMER_END];
+ BOOL m_isPrevErrEventCompleted;
+ EFrameworkunifiedStatus m_errorEventResult;
+ EArtifactId m_requestedArtifactId;
+ ERROR_EVENT_QUEUE_ITER m_errorEventCurrentIter;
+ // *
+ // End of Error Event Logging *
+ //************************************************************************
+
+
+ ////******************************************************************////
+ //// enum<=>enum maps ////
+ //
+ //
+ // EPWR_POWER_STATE_TYPE <=> BOOL
+ std::map<EPWR_POWER_STATE_TYPE, BOOL> m_PowerType_to_SSBoolEnumMap;
+ std::map<EPWR_POWER_STATE_TYPE, EPWR_USER_MODE_TYPE>
+ m_PowerType_to_SSUserModeEnumMap;
+ std::map<BOOL, EPWR_POWER_STATE_TYPE> m_SSBool_to_PowerTypeEnumMap;
+ //
+ // User Mode
+ std::map<EPWR_USER_MODE_TYPE, BOOL> m_SSUserMode_to_SSBoolEnumMap;
+ std::map<BOOL, EPWR_USER_MODE_TYPE> m_SSBool_to_SSUserModeEnumMap;
+
+ //
+ //// End of enum<=>enum maps ////
+ ////******************************************************************////
+
+ EFrameworkunifiedStatus init_process_launcher(HANDLE hApp);
+ EFrameworkunifiedStatus start_process_launching(HANDLE hApp);
+ EFrameworkunifiedStatus init_Heartbeat(HANDLE hApp);
+ EFrameworkunifiedStatus init_crash_detector(HANDLE hApp);
+ EFrameworkunifiedStatus init_sysmem_monitor(HANDLE hApp);
+ EFrameworkunifiedStatus SendRequestToHeartBeat(HANDLE hAPP, EHBProtocolMessages, VOID *, UI_32);
+ EFrameworkunifiedStatus send_launch_status(HANDLE hApp, UI_32 u32LaunchState);
+
+ EFrameworkunifiedStatus register_all_notification_callbacks(HANDLE hApp);
+ VOID SMStateStartCompleteEntry(HANDLE hApp);
+ VOID SMStateEntry(HANDLE hApp, SS_SMModuleState l_SMState);
+ VOID SMStateExit(HANDLE hApp, SS_SMModuleState l_SMState);
+ VOID SMSetState(HANDLE hApp, SS_SMModuleState l_SMState);
+
+ // Wakeup from Power
+ EFrameworkunifiedStatus BeginStartup(HANDLE hApp);
+ EFrameworkunifiedStatus start_all_modules_of_group(HANDLE hApp, UI_32 f_ui32GroupNumber);
+ EFrameworkunifiedStatus send_power_request_complete_response(HANDLE hApp,
+ std::string pStr);
+ BOOL have_all_services_start_completed(const SMModuleState f_moduleState);
+
+ // Power Off from Power
+ EFrameworkunifiedStatus PublishPowerOnOffNotification(HANDLE hApp);
+
+ // Shutdown from Power
+ EFrameworkunifiedStatus stop_all_modules_of_group(HANDLE hApp);
+ UI_32 calculate_max_shutdown_time();
+ BOOL is_service_shutdown_ready(ModuleLaunchListIter &modIte); // NOLINT
+ BOOL have_critical_services_stopped();
+ VOID check_all_groups_have_stopped(HANDLE hApp);
+ EFrameworkunifiedStatus perform_force_reset(HANDLE hApp);
+ EFrameworkunifiedStatus send_shutdown_complete_response(HANDLE hApp);
+ EFrameworkunifiedStatus SendShutdownResponseMessage(HANDLE hApp);
+
+ PsmFactorT GetResetFactor(PCSTR f_module_name, BOOL f_user_reset);
+ PsmFactorT GetResetFactor(const ModuleLaunchListIter f_module_iter, BOOL f_user_reset);
+
+ EFrameworkunifiedStatus ValidateUserModeMessage(HANDLE hApp, EPWR_USER_MODE_TYPE &l_eUserModeState); // NOLINT
+
+ VOID SetStartGroup();
+
+ VOID ReadPathFromEnvironmentVariables();
+ SS_String ReadConfigDataFileNameFromEnvironmentVariable();
+ SS_String ReadLaunchConfigFileNameFromEnvironmentVariable();
+
+
+ VOID ReadUsingVMPlayerEnvironmentVariable();
+
+ VOID InitiateAllGroupsShutdown(HANDLE hApp);
+ VOID SendDeferMsg(HANDLE hApp);
+ EFrameworkunifiedStatus GetVersionNumber(SS_VersionNumberType &f_VersionNumber); // NOLINT
+ EFrameworkunifiedStatus GetBuildInfo(std::string &f_BuildInfoStr); // NOLINT
+ EFrameworkunifiedStatus RegisterCallbacksForRequester(HANDLE hApp, PCSTR pRequester);
+ EFrameworkunifiedStatus SetSystemModeInfoStruct();
+
+ EFrameworkunifiedStatus PerformLaunchProcedure(HANDLE hApp
+ , ModuleLaunchListIter f_ModuleIterator
+ , SS_String & f_stopCompName); // NOLINT
+
+ EFrameworkunifiedStatus PerformTerminateProcedure(HANDLE hApp
+ , ModuleLaunchListIter f_ModuleIterator
+ , SS_String & f_availabilityName
+ , SS_String & f_stopCompName); // NOLINT
+
+ EFrameworkunifiedStatus SendRequestToLauncher(HANDLE hApp
+ , ModuleLaunchListIter f_ModuleIterator
+ , ESMPLThreadCommandIds f_CommandId
+ , SS_String f_CommandIdStr);
+
+ EFrameworkunifiedStatus FindNameOfTerminatedProcess(SI_32 pid, SS_String &f_ModuleName); // NOLINT
+
+ EFrameworkunifiedStatus GetBinaryNameOfProcess(SS_String f_ModuleQueueName,
+ SS_String &f_ModuleBinaryName); // NOLINT
+
+ EFrameworkunifiedStatus RemoveModuleEntryFromHB(HANDLE hApp, const CHAR *f_ModuleName);
+
+ EFrameworkunifiedStatus PublishUserModeNotification(HANDLE hApp);
+ EFrameworkunifiedStatus PerformPowerOnOffUserModePublication(
+ HANDLE hApp,
+ const char * p_NotificationStr);
+ EFrameworkunifiedStatus SendSystemModeInfoResponse(
+ HANDLE hApp,
+ EPWR_STARTUP_STAGE_TYPE f_startupStage);
+
+ VOID SYSTEMMANAGERLOG_StartupConfirmationMsg(EPWR_SC_MSG_STRUCT & f_scMsg); // NOLINT
+ VOID LogGroupModulesState(UI_32 f_groupId, std::string pStr);
+ VOID LogAllGroupModulesState(std::string pStr);
+
+ EFrameworkunifiedStatus ProcessGroupAsStarted(HANDLE hApp
+ , GroupLaunchMapIter f_GroupIterator);
+ EFrameworkunifiedStatus ProcessGroupAsStarted(HANDLE hApp
+ , UI_32 f_groupId);
+ EFrameworkunifiedStatus GetModuleIterator(PCSTR f_moduleName, ModuleLaunchListIter & f_moduleIter); // NOLINT
+ BOOL IsGroupStarted(UI_32 f_groupId);
+ BOOL IsGroupStopped(UI_32 f_groupId);
+ EFrameworkunifiedStatus ResetModulesStateToConnected(HANDLE hApp);
+
+ EFrameworkunifiedStatus GetTimeStamp(std::string& TimeStamp); // NOLINT
+ std::string GetErrorEventInString(UI_32 &ErrorEventType); // NOLINT
+ EFrameworkunifiedStatus GetLastSourceInfo(SS_SOURCE &source_type); // NOLINT
+ //
+ // Return True when Module is in correct / appropriate state wrt SM state
+ // return false otherwise
+ BOOL GetModuleCondition(ModuleLaunchListIter & f_ModuleIter); // NOLINT
+
+ VOID LogESystemmanagerStatusEnums();
+ VOID LogProtocolIDs();
+
+ VOID SystemmanagerLogString(TFrameworkunifiedZone f_zone,
+ PCSTR f_func,
+ std::string &f_text); // NOLINT
+
+ inline BOOL is_current_state(SS_SMModuleState SMState) {
+ return (m_SMCurrentState == SMState);
+ }
+
+ //**************************************************************************
+ // Get results from TestClient *
+ // *
+ EFrameworkunifiedStatus add_state_information_to_response(CHAR *f_MessageResponse) const;
+ EFrameworkunifiedStatus construct_get_result_response(CHAR *f_MessageResponse); // *
+ EFrameworkunifiedStatus open_session_with_sm_test_client(HANDLE hApp, // *
+ PCSTR pRequester); // *
+ // *
+ // End of 'Get results from TestClient' *
+ //**************************************************************************
+
+ //************************************************************************
+ // Error Event Logging *
+ // *
+ EFrameworkunifiedStatus ErrorEventInit(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnHeartBeatErrorDetected(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnProcessTermDetected(HANDLE f_hApp);
+ BOOL isPreLaunchedProcess(int f_pid);
+ EFrameworkunifiedStatus OnPreLaunchedProcessTermDetected(HANDLE f_hApp,
+ SMProcessExitInfo &f_procExitInfo, // NOLINT
+ BOOL f_bIsExited);
+ EFrameworkunifiedStatus OnProcessCrashDetected(HANDLE f_hApp,
+ SMProcessExitInfo &f_procExitInfo); // NOLINT
+ EFrameworkunifiedStatus OnProcessExitDetected(HANDLE f_hApp,
+ SMProcessExitInfo &f_procExitInfo); // NOLINT
+
+ EFrameworkunifiedStatus OnUserInvokedLoggingRequest(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnEelExportRequest(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnSystemmanagerEmmcLogsRequest(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnSystemmanagerClearLogsRequest(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnDiagLoggingRequest(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnCANLoggingRequest(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnPropagateSystemError(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnCaptureAllLogsRequest(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnCaptureScreenShotRequest(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnCaptureSystemmanagerLogsRequest(HANDLE f_hApp);
+
+
+ EFrameworkunifiedStatus OnBootMicroResetNotification(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnObtainBootMicroLog(HANDLE f_hApp);
+ EFrameworkunifiedStatus RequestBootMicroLog(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnBootMicroLogResponse(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnErrorEventBootMicroLogResponseTimeout(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnLowSystemMemory(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnObtainSystemmanagerSystemDataCsv(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnObtainShowMemTxt(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnErrorEventCoreFilePollTimeout(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnObtainDebugDumpLog(HANDLE f_hApp);
+ EFrameworkunifiedStatus SendDebugDumpRequestToAllModules(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnDebugDumpResponseReceived(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnDebugDumpCompleteTimeout(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus ErrorEventEnqueue(HANDLE f_hApp,
+ EErrorEventType f_eventType,
+ std::string &f_moduleQueueName, // NOLINT
+ EErrorEventResetType f_resetType = eErrorEventResetTypeNone,
+ const SMLoggingInfo &f_loggingInfo = SMLoggingInfo());
+
+ EFrameworkunifiedStatus PerformResetAfterLogging(HANDLE f_hApp,
+ ESMCpuResetReason f_eCpuResetReason,
+ std::string f_messageStr = "");
+
+ EFrameworkunifiedStatus ErrorEventProcessNext(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnLoggingStartRequest(HANDLE f_hApp);
+ EFrameworkunifiedStatus OnErrorEventLoggerStartRequestTimeout(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus OnErrorEventArtifactRequest(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus SendLogArtifactResponseToLogger(HANDLE f_hApp,
+ EArtifactId f_artifactId,
+ std::string f_artifactFilePathAndName);
+
+ EFrameworkunifiedStatus OnErrorEventLoggingComplete(HANDLE f_hApp);
+
+ EFrameworkunifiedStatus ActOnModuleFailure(HANDLE f_hApp,
+ SS_String f_moduleName,
+ BOOL &f_refResetRequired); // NOLINT
+ std::string ErrorEventCreateHmiDisplayString(void);
+
+ // *
+ // End of Error Event Logging *
+ //************************************************************************
+
+ UI_32 m_SystemManagerPriority;
+};
+#define REC_HIST(pStrCmd, hist, it, pStrSender) \
+ SetCmdHist(pStrCmd, hist, it, pStrSender);
+
+#define REC_HIST_IF_SUCCESSFUL(pStr, hist, it, sender, l_eStatus) \
+ if (eFrameworkunifiedStatusOK == l_eStatus) { \
+ REC_HIST(pStr, hist, it, sender) \
+ }
+
+#define LOG_ERROR_REC_HIST(l_eStatus, pStr) { \
+ LOG_ERROR(pStr); \
+ REC_HIST(pStr, m_ErrHist, m_ErrHistIter, GetStr(l_eStatus).c_str()); \
+ }
+#define LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, pStr) \
+ if (eFrameworkunifiedStatusOK != l_eStatus) { \
+ LOG_ERROR(pStr); \
+ REC_HIST(pStr, m_ErrHist, m_ErrHistIter, GetStr(l_eStatus).c_str()); \
+ } else { \
+ LOG_SUCCESS(pStr); \
+ } // End of #define LOG_STATUS(l_eStatus,pStr)
+
+#define LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, pStr) \
+ if (eFrameworkunifiedStatusOK != l_eStatus) { \
+ LOG_ERROR(pStr); \
+ REC_HIST(pStr, m_ErrHist, m_ErrHistIter, GetStr(l_eStatus).c_str()); \
+ } // End of #define LOG_STATUS_IF_ERRORED(l_eStatus,pStr)
+
+#endif // __SS_SYSTEM_MANAGER_H__ // NOLINT
diff --git a/systemservice/system_manager/server/include/ss_system_manager_callbacks.h b/systemservice/system_manager/server/include/ss_system_manager_callbacks.h
new file mode 100644
index 00000000..e9d59388
--- /dev/null
+++ b/systemservice/system_manager/server/include/ss_system_manager_callbacks.h
@@ -0,0 +1,29 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for System Manager business logic.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_SYSTEM_MANAGER_CALLBACKS_H_ // NOLINT
+#define SS_SYSTEM_MANAGER_CALLBACKS_H_
+
+#include <native_service/frameworkunified_types.h>
+#include <native_service/frameworkunified_framework_if.h>
+
+#endif // SS_SYSTEM_MANAGER_CALLBACK_H_ // NOLINT
diff --git a/systemservice/system_manager/server/include/ss_system_memory_monitor.h b/systemservice/system_manager/server/include/ss_system_memory_monitor.h
new file mode 100644
index 00000000..50cf8574
--- /dev/null
+++ b/systemservice/system_manager/server/include/ss_system_memory_monitor.h
@@ -0,0 +1,85 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for System Manager System Low Memory
+/// detection.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef __SS_SYSTEM_MEMORY_MONITOR_H__ // NOLINT
+#define __SS_SYSTEM_MEMORY_MONITOR_H__
+
+#include <native_service/frameworkunified_types.h>
+#include <system_service/resm.h>
+#include <system_service/ss_system_timer.h>
+#include <iostream>
+#include <string>
+#include "ss_sm_config.h"
+
+
+typedef enum _ESMSysMemThreadCommandIds {
+ eSysMemThrdCmd_SYS_LOW_MEMORY = 0x744, ///< SM.CrashDetector --> SM
+} ESMSysMemThreadCommandIds;
+
+struct SysMem {
+ UI_32 FreeMemoryBytes;
+ UI_32 TotalMemoryBytes;
+};
+
+const UI_32 SS_SLM_MEM_MONITOR_TIMER_ID = 3000;
+const UI_32 SS_SLM_SYSTEMMANAGERLOG_TIMER_ID = 3001;
+const UI_32 SS_MEMORY_TIMER_CONFIG_MS = 1000;
+const UI_32 SS_SYSTEMMANAGERLOG_TIMER_CONFIG_MS = 30000;
+
+class CSysMemoryMonitor {
+ public:
+ CSysMemoryMonitor(void);
+
+ virtual ~CSysMemoryMonitor(void);
+
+ EFrameworkunifiedStatus Initialize(HANDLE f_hApp);
+ EFrameworkunifiedStatus StopAndFreeObjects(HANDLE f_hApp);
+
+ const std::string GetThreadName(void);
+ void SetSLMConfigData(SLMConfigParameters &f_ConfigData); // NOLINT
+
+ private:
+ EFrameworkunifiedStatus CPUMemThreadStart(HANDLE f_hThread);
+ EFrameworkunifiedStatus CPUMemThreadStop(HANDLE f_hThread);
+ EFrameworkunifiedStatus StopTimers(void);
+ EFrameworkunifiedStatus OnMemoryTimerExpiry(HANDLE f_hThread);
+ EFrameworkunifiedStatus OnSystemmanagerlogTimerExpiry(HANDLE f_hThread);
+ EFrameworkunifiedStatus OnAvailability(HANDLE f_hThread);
+
+ UI_32 GetSystemRamSize(void);
+ UI_32 BitReverse32(UI_32 f_val);
+
+ HANDLE m_hThread;
+ HANDLE m_hParentApp;
+ Timer m_memMonitorTimer;
+ Timer m_systemmanagerlogTimer;
+ SLMConfigParameters m_SLMConfig;
+ SI_32 m_SLMCheckCounter;
+ SI_32 m_siPriority;
+ UI_32 m_NbrSamplesBeforeSystemmanagerlog;
+ SysMem m_sysMemInfoLast;
+ std::string m_memMonitorThreadName;
+ uint32_t m_resmSession;
+};
+
+#endif // __SS_SYSTEM_MEMORY_MONITOR_H__ // NOLINT
diff --git a/systemservice/system_manager/server/include/ss_system_thread_info.h b/systemservice/system_manager/server/include/ss_system_thread_info.h
new file mode 100644
index 00000000..f21ad5a9
--- /dev/null
+++ b/systemservice/system_manager/server/include/ss_system_thread_info.h
@@ -0,0 +1,45 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for System Manager thread management.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_SYSTEM_THREAD_INFO_H_ // NOLINT
+#define SS_SYSTEM_THREAD_INFO_H_
+
+#include <native_service/frameworkunified_types.h>
+
+typedef enum {
+ eSM_ThreadNotExist
+ , eSM_ThreadCreated
+ , eSMThreadIsFine
+ , eSMWaitForHeartbeat
+ , eSM_ThreadError
+} ESMThreadInfo;
+
+class CThreadInfo {
+ public:
+ CThreadInfo() : m_ThreadHdl(INVALID_HANDLE), m_ThreadState(eSM_ThreadNotExist) {}
+ CThreadInfo(HANDLE hdl, ESMThreadInfo State) : m_ThreadHdl(hdl), m_ThreadState(State) {}
+ public:
+ HANDLE m_ThreadHdl;
+ ESMThreadInfo m_ThreadState;
+};
+
+#endif // SS_SYSTEM_THREAD_INFO_H_ // NOLINT
diff --git a/systemservice/system_manager/server/include/system_launcher_cfg_format.h b/systemservice/system_manager/server/include/system_launcher_cfg_format.h
new file mode 100644
index 00000000..b30b21fd
--- /dev/null
+++ b/systemservice/system_manager/server/include/system_launcher_cfg_format.h
@@ -0,0 +1,66 @@
+
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+///////////////////////////////////////////////////////////////////////////////
+/// \ingroup tag_SystemManager
+/// \brief This file provides support for System Manager process launching.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef SS_SM_LAUNCH_CONFIG_H_ // NOLINT
+#define SS_SM_LAUNCH_CONFIG_H_
+
+#include <native_service/frameworkunified_types.h>
+
+typedef struct _tLaunchParams {
+ const PCHAR group_name;
+ UI_32 group_id;
+ UI_32 group_launch_wait;
+ const PCHAR name;
+ const PCHAR binary_name;
+ UI_32 priority;
+ BOOL critical;
+ UI_32 retry_cnt;
+ const PCHAR arguments;
+ const PCHAR logging_msk_str;
+ const PCHAR restart;
+ BOOL is_start_required;
+ BOOL shutdown_critical;
+ UI_32 shutdown_wait_time;
+ UI_32 fast_shutdown_wait_time;
+
+ public:
+ BOOL IsAGLUnit(void) const { return is_agl_unit; }
+ BOOL IsAGLResetHistoryDisable(void) const { return disable_agl_resethistory; }
+ BOOL IsNonAGLResetHistoryDisable(void) const { return disable_nonagl_resethistory; }
+ void SetAGLUnit(BOOL f_is_agl_unit) { is_agl_unit = f_is_agl_unit; }
+ void SetAGLResetHistoryDisable(BOOL f_disable_agl_resethistory) {
+ disable_agl_resethistory = f_disable_agl_resethistory;
+ }
+ void SetNonAGLResetHisoryDisable(BOOL f_disable_nonagl_resethistory) {
+ disable_nonagl_resethistory = f_disable_nonagl_resethistory;
+ }
+
+ private:
+ BOOL is_agl_unit;
+ BOOL disable_agl_resethistory;
+ BOOL disable_nonagl_resethistory;
+} LaunchInfo;
+
+LaunchInfo g_arrLaunchTableCfg[] = {
+};
+#endif // SS_SM_LAUNCH_CONFIG_H_ // NOLINT