iPower.h
Go to the documentation of this file.
1 
4 #pragma once
5 
6 #include <string>
7 #include <vector>
8 #include <boost/system/error_code.hpp>
9 
10 #define WAKEUPDATE_FORMAT "%a %b %d %Y %H:%M:%S"
11 
17 namespace dpyPowermanager {
18 
23 typedef boost::function<void(const bool &available)> service_availability_handler;
24 
28 enum Cause
29 {
30  DEFAULT = 0,
32  MCU_ERROR = 2,
33  IGNITION_OFF_TIMEOUT = 3
34 };
35 
39 enum Request
40 {
42  REQ_REBOOT = 1,
45  REQ_ABORT = 4,
46 };
47 
51 enum Action
52 {
53  POWER_ON = 0,
54  REBOOT = 1,
55  STANDBY = 2,
56  SHUTDOWN = 3,
57 };
58 
63 {
67 };
68 
73 {
74  NONE = 0,
75  COMPLETED = 1,
76  STARTED = 2,
78 };
79 
83 enum Debug
84 {
85  NA_DEBUG = 0,
86  ENABLE = 1,
87  DISABLE = 2
88 };
89 
93 struct PowerEvent
94 {
95  PowerEvent(){
96 
97  };
98 
100  {
101  action = ev_action;
102  cause = ev_cause;
103  type = ev_type;
104  };
105  std::string timestamp;
107  Cause cause = Cause::DEFAULT;
109 };
110 
115 {
117  Cause cause = Cause::DEFAULT;
118 };
119 
123 struct Timers
124 {
125  std::uint32_t standby = 0;
126  std::uint32_t shutdown = 0;
127 
128 };
129 
134 {
135  std::uint32_t cancelTime = 0;
136  std::uint32_t guardTime = 0;
137 };
138 
142 typedef boost::function<void(boost::system::error_code& ec, dpyPowermanager::PowerEvent event)> event_handler_function;
143 typedef boost::function<void(boost::system::error_code ec, bool active)> debug_pm_handler_function;
144 typedef boost::function<void(boost::system::error_code& ec)> answer_pm_handler_function;
145 typedef boost::function<void(boost::system::error_code& ec, dpyPowermanager::Timers)> timers_pm_handler_function;
146 typedef boost::function<void(boost::system::error_code& ec, bool rightConfiguration)> power_rails_handler_function;
147 typedef boost::function<void(boost::system::error_code& ec, bool standbyEnabled, bool haltEnabled)> timers_state_pm_handler_function;
148 typedef boost::function<void(boost::system::error_code& ec, dpyPowermanager::TransitionIntervals)> transition_intervals_pm_handler_function;
149 typedef boost::function<void(boost::system::error_code& ec, struct tm dateTime)> wakeup_time_pm_handler_function;
150 typedef boost::function<void(boost::system::error_code& ec, int minutes)> ignition_off_timeout_pm_handler_function;
151 
152 }
A struct which represents the message that might be received from the service. It indicates when it w...
Definition: iPower.h:114
The MCU is not ready for the transition.
Definition: iPower.h:32
The request to restart the system.
Definition: iPower.h:42
The request to switch on the system.
Definition: iPower.h:41
COMPLETED and STARTED messages.
Definition: iPower.h:77
Request
The enum definition of the different types of Power Manager Requests.
Definition: iPower.h:39
ConfigType
An enum definition which represents the different types of messages that it is wanted to be subscribe...
Definition: iPower.h:72
EventType type
The identity of the request, SET or WARN request.
Definition: iPower.h:108
The request to abort a request on course. It is only possible to abort the following requests: REBOOT...
Definition: iPower.h:45
boost::function< void(boost::system::error_code &ec, dpyPowermanager::TransitionIntervals)> transition_intervals_pm_handler_function
Transition Intervals handler function.
Definition: iPower.h:148
std::string timestamp
A timestamp which represents when was asked the request.
Definition: iPower.h:104
boost::function< void(const bool &available)> service_availability_handler
Prototype of the handler function used to monitor service availability.
Definition: iPower.h:23
The request to switchoff the system.
Definition: iPower.h:56
boost::function< void(boost::system::error_code &ec)> answer_pm_handler_function
Answer handler function.
Definition: iPower.h:144
Cause cause
Cause of the event.
Definition: iPower.h:107
Automatic mode, debug mode enabled.
Definition: iPower.h:87
The request to switch off the system.
Definition: iPower.h:44
boost::function< void(boost::system::error_code &ec, dpyPowermanager::PowerEvent event)> event_handler_function
Handlers to the functions the client has to implement.
Definition: iPower.h:142
boost::function< void(boost::system::error_code &ec, dpyPowermanager::Timers)> timers_pm_handler_function
Timers handler function.
Definition: iPower.h:145
COMPLETED messages.
Definition: iPower.h:75
Action
The enum definition of the different types of Power Manager Requests.
Definition: iPower.h:51
Manual mode, debug mode disabled.
Definition: iPower.h:86
An Aborting message, it indicates that the previous action was aborted.
Definition: iPower.h:66
The request to restart the system.
Definition: iPower.h:54
A struct which store the values of the transition intervals.
Definition: iPower.h:133
boost::function< void(boost::system::error_code &ec, bool standbyEnabled, bool haltEnabled)> timers_state_pm_handler_function
Timers State handler function.
Definition: iPower.h:147
The request to turn on standby mode (suspend to ram).
Definition: iPower.h:43
Not available.
Definition: iPower.h:85
The request to switch on the system.
Definition: iPower.h:53
A Completed message, it indicates that it is going to turn on the indicated action.
Definition: iPower.h:65
Cause
The enum definition of the different types of causes.
Definition: iPower.h:28
boost::function< void(boost::system::error_code &ec, bool rightConfiguration)> power_rails_handler_function
Power Rails handler function.
Definition: iPower.h:146
The request to turnon standby mode (suspend to ram).
Definition: iPower.h:55
A Started message, it indicates that it is wanted to change the power state. However, it exits the possibility of aborting it.
Definition: iPower.h:64
A struct which represents the message that might be received from the service. It indicates when it w...
Definition: iPower.h:93
Debug
An enum definition which represents the different modes of the Automatic Power configuration.
Definition: iPower.h:83
Action action
The action that is wanted to be taken.
Definition: iPower.h:106
STARTED messages.
Definition: iPower.h:76
Deepsy PowerManager namespace that includes the different enums, structs or method signatures that sh...
The action of warning the critical battery status.
Definition: iPower.h:31
No messages.
Definition: iPower.h:74
A struct which store the values of the power wakeup timers.
Definition: iPower.h:123
EventType
Identity of the kind of received message.
Definition: iPower.h:62
boost::function< void(boost::system::error_code &ec, struct tm dateTime)> wakeup_time_pm_handler_function
Wakeup Time handler function.
Definition: iPower.h:149
boost::function< void(boost::system::error_code ec, bool active)> debug_pm_handler_function
Debug handler to check if the debug is active or not.
Definition: iPower.h:143
boost::function< void(boost::system::error_code &ec, int minutes)> ignition_off_timeout_pm_handler_function
Ignition Off Timeout handler function.
Definition: iPower.h:150