summaryrefslogtreecommitdiffstats
path: root/power_service/server/include/ss_power_config.h
blob: 09ca70d981f6903b304d829deb2d837f05dd8846 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
/*
 * @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_PowerService
/// \brief    This file supports power service configuration.
///
///////////////////////////////////////////////////////////////////////////////
#ifndef POWER_SERVICE_SERVER_INCLUDE_SS_POWER_CONFIG_H_
#define POWER_SERVICE_SERVER_INCLUDE_SS_POWER_CONFIG_H_


#include <system_service/ss_system_types.h>
#include <system_service/ss_templates.h>
#include <native_service/ns_config_parser_if.h>
#include <list>
#include <string>
#include "ss_power_powerservicelog.h"

typedef std::list<SS_String> RequiredModuleList;
typedef RequiredModuleList::iterator RequiredModuleListIter;

#define SS_PWR__CWORD56__REP_HIST_SIZE     (10u)
#define SS_PWR_PUB_CMD_HIST_SIZE      (5u)
#define SS_PWR_ERR_HIST_SIZE          (5u)
#define SS_PWR_V_HIST_SIZE            (10u)
#define SS_PWR_DEBUG_DUMP_MAX_SIZE    (4096u)

typedef struct _PowerConfigParams {  // NOLINT (readability/naming)  // LCOV_EXCL_BR_LINE 14:it will be called when poweron
  typedef struct {
    SI_32 timeout;
    struct {
      BOOL enabled;
      SI_32 timeout;
      SI_32 tries;
    } hysteresis;
  } PowerOffInfo;

  SS_String power_logic_plugin;
  PowerOffInfo lvi1;
  PowerOffInfo lvi2;
  PowerOffInfo shutdown;
  RequiredModuleList wakeup_modules;
  RequiredModuleList shutdown_modules;
  RequiredModuleList lvi2_modules;
} PowerConfigParams;

class PowerConfiguration {
 public:
  // define all the configuration parmeters that will be used to get data
  static const char * kPowerLogicPlugin;
  static const char * kLVI1Timeout;
  static const char * kLVI1HysteresisTimeout;
  static const char * kLVI1HysteresisEnabled;
  static const char * kLVI1HysteresisTries;
  static const char * kLVI2Timeout;
  static const char * kLVI2HysteresisTimeout;
  static const char * kLVI2HysteresisEnabled;
  static const char * kLVI2HysteresisTries;
  static const char * kShutdownTimeout;
  static const char * kShutdownHysteresisTimeout;
  static const char * kShutdownHysteresisEnabled;
  static const char * kShutdownHysteresisTries;

  /// < defines the names in the xml file that are used to get required modules names
  static const char * kRequiredWakeupModules;  /// < once all the modules have been wakened up send wake-up complete
  static const char * kRequiredShutdownModules;  /// < once all the modules have been shutdown send shutdown complete
  static const char * kRequiredLvi2Modules;  /// < once all the modules have been wakened up send wake-up complete

  ////////////////////////////////////////////////////////////////////////////////////////////
  ///  PowerConfiguration
  ///  \brief Here it is checked whether the new connection is to be connected or not, if yes then whether the old
  ///  connection is  to be disconnected or to be paused or to be played simultaneously.
  ///
  /// \param [in] f_configFileName  Configuration file name.
  ///
  /// \return NA
  ///
  ////////////////////////////////////////////////////////////////////////////////////////////
  explicit PowerConfiguration(std::string f_configfilename);

  ////////////////////////////////////////////////////////////////////////////////////////////
  ///  ~PowerConfiguration
  ///  \brief Here it is checked whether the new connection is to be connected or not, if yes then whether the old
  ///  connection is  to be disconnected or to be paused or to be played simultaneously.
  ///
  /// \param [in] pRequestingSrc
  ///         Source* - Pointer to the requesting source.
  ///
  /// \return bool
  ///         bool - TRUE or FALSE
  ////////////////////////////////////////////////////////////////////////////////////////////
  virtual ~PowerConfiguration();

  ////////////////////////////////////////////////////////////////////////////////////////////
  ///  LoadParameters
  ///  \brief Load module parameters from configuration file.
  ///
  /// \param [in] params - Ref to variable which to store the loaded module parameters.
  ///
  /// \return bool
  ///         bool - TRUE or FALSE
  ////////////////////////////////////////////////////////////////////////////////////////////
  BOOL LoadParameters(PowerConfigParams & params);  // NOLINT (runtime/references)

  ////////////////////////////////////////////////////////////////////////////////////////////
  ///  LoadDefaultParameters
  ///  \brief Laod default power services parameters.
  ///
  /// \param [in] params - Ref to variable for which to store the default module parameters.
  ///
  /// \return none
  ////////////////////////////////////////////////////////////////////////////////////////////
  void LoadDefaultParameters(PowerConfigParams & params);  // NOLINT (runtime/references)

  ////////////////////////////////////////////////////////////////////////////////////////////
  ///  PrintConfigInfo
  ///  \brief Print configuration information.
  ///
  /// \param [in] params - Ref to variable containing the configuration parameters to load.params
  ///
  /// \return none.
  ////////////////////////////////////////////////////////////////////////////////////////////
  void PrintConfigInfo(PowerConfigParams & f_params);  // NOLINT (runtime/references)

 protected:
  PowerConfiguration(const PowerConfiguration &);
  PowerConfiguration & operator =(const PowerConfiguration &);  // NOLINT (runtime/references)

 private:
  std::string m_ConfigFileName;
};

#endif  // POWER_SERVICE_SERVER_INCLUDE_SS_POWER_CONFIG_H_