2 * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 ///////////////////////////////////////////////////////////////////////////////
18 /// \ingroup tag_PowerService
19 /// \brief This file supports power service configuration.
21 ///////////////////////////////////////////////////////////////////////////////
22 #ifndef POWER_SERVICE_SERVER_INCLUDE_SS_POWER_CONFIG_H_
23 #define POWER_SERVICE_SERVER_INCLUDE_SS_POWER_CONFIG_H_
26 #include <system_service/ss_system_types.h>
27 #include <system_service/ss_templates.h>
28 #include <native_service/ns_config_parser_if.h>
31 #include "ss_power_powerservicelog.h"
33 typedef std::list<SS_String> RequiredModuleList;
34 typedef RequiredModuleList::iterator RequiredModuleListIter;
36 #define SS_PWR__CWORD56__REP_HIST_SIZE (10u)
37 #define SS_PWR_PUB_CMD_HIST_SIZE (5u)
38 #define SS_PWR_ERR_HIST_SIZE (5u)
39 #define SS_PWR_V_HIST_SIZE (10u)
40 #define SS_PWR_DEBUG_DUMP_MAX_SIZE (4096u)
42 typedef struct _PowerConfigParams { // NOLINT (readability/naming) // LCOV_EXCL_BR_LINE 14:it will be called when poweron
52 SS_String power_logic_plugin;
55 PowerOffInfo shutdown;
56 RequiredModuleList wakeup_modules;
57 RequiredModuleList shutdown_modules;
58 RequiredModuleList lvi2_modules;
61 class PowerConfiguration {
63 // define all the configuration parmeters that will be used to get data
64 static const char * kPowerLogicPlugin;
65 static const char * kLVI1Timeout;
66 static const char * kLVI1HysteresisTimeout;
67 static const char * kLVI1HysteresisEnabled;
68 static const char * kLVI1HysteresisTries;
69 static const char * kLVI2Timeout;
70 static const char * kLVI2HysteresisTimeout;
71 static const char * kLVI2HysteresisEnabled;
72 static const char * kLVI2HysteresisTries;
73 static const char * kShutdownTimeout;
74 static const char * kShutdownHysteresisTimeout;
75 static const char * kShutdownHysteresisEnabled;
76 static const char * kShutdownHysteresisTries;
78 /// < defines the names in the xml file that are used to get required modules names
79 static const char * kRequiredWakeupModules; /// < once all the modules have been wakened up send wake-up complete
80 static const char * kRequiredShutdownModules; /// < once all the modules have been shutdown send shutdown complete
81 static const char * kRequiredLvi2Modules; /// < once all the modules have been wakened up send wake-up complete
83 ////////////////////////////////////////////////////////////////////////////////////////////
84 /// PowerConfiguration
85 /// \brief Here it is checked whether the new connection is to be connected or not, if yes then whether the old
86 /// connection is to be disconnected or to be paused or to be played simultaneously.
88 /// \param [in] f_configFileName Configuration file name.
92 ////////////////////////////////////////////////////////////////////////////////////////////
93 explicit PowerConfiguration(std::string f_configfilename);
95 ////////////////////////////////////////////////////////////////////////////////////////////
96 /// ~PowerConfiguration
97 /// \brief Here it is checked whether the new connection is to be connected or not, if yes then whether the old
98 /// connection is to be disconnected or to be paused or to be played simultaneously.
100 /// \param [in] pRequestingSrc
101 /// Source* - Pointer to the requesting source.
104 /// bool - TRUE or FALSE
105 ////////////////////////////////////////////////////////////////////////////////////////////
106 virtual ~PowerConfiguration();
108 ////////////////////////////////////////////////////////////////////////////////////////////
110 /// \brief Load module parameters from configuration file.
112 /// \param [in] params - Ref to variable which to store the loaded module parameters.
115 /// bool - TRUE or FALSE
116 ////////////////////////////////////////////////////////////////////////////////////////////
117 BOOL LoadParameters(PowerConfigParams & params); // NOLINT (runtime/references)
119 ////////////////////////////////////////////////////////////////////////////////////////////
120 /// LoadDefaultParameters
121 /// \brief Laod default power services parameters.
123 /// \param [in] params - Ref to variable for which to store the default module parameters.
126 ////////////////////////////////////////////////////////////////////////////////////////////
127 void LoadDefaultParameters(PowerConfigParams & params); // NOLINT (runtime/references)
129 ////////////////////////////////////////////////////////////////////////////////////////////
131 /// \brief Print configuration information.
133 /// \param [in] params - Ref to variable containing the configuration parameters to load.params
136 ////////////////////////////////////////////////////////////////////////////////////////////
137 void PrintConfigInfo(PowerConfigParams & f_params); // NOLINT (runtime/references)
140 PowerConfiguration(const PowerConfiguration &);
141 PowerConfiguration & operator =(const PowerConfiguration &); // NOLINT (runtime/references)
144 std::string m_ConfigFileName;
147 #endif // POWER_SERVICE_SERVER_INCLUDE_SS_POWER_CONFIG_H_