mcuApiPrivate.h
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include "mcuApi.h"
9 
10 namespace dpyMcu {
15  namespace dpyPowerstatesflags {
16  const std::uint32_t NONE_EXIT = 0x00;
17  const std::uint32_t IGNITION_EXIT = 0x01;
18  const std::uint32_t TIMERS_EXIT = 0x02;
19  }
22  {
23  std::string port_id;
25  };
26 
32  typedef boost::function<void(boost::system::error_code error_code, dpyMcu::SerialPortProtocolConfig &)> serialport_handler_function;
33 
39  typedef boost::function<void(boost::system::error_code error_code, dpyMcu::CANBusFrame frame)> get_can_bus_message_handler_function;
40 }
41 
46 {
47 public:
52  virtual void NewCANBusFrame(dpyMcu::CANBusFrame frame) = 0;
56  virtual ~CANBusObserver()
57  {
58  }
59 };
60 
64 static std::vector<CANBusObserver*> CANBusObserversList;
65 
70 class McuPrivate: public Mcu
71 {
72 public:
73 
78  explicit McuPrivate(std::string ip = "127.0.0.1");
79 
83  virtual ~McuPrivate();
84 
90  boost::system::error_code subscribe(CANBusObserver *observer);
91 
97  boost::system::error_code unsubscribe(CANBusObserver *observer);
98 
100 #ifndef TESTING
101 
107  void asyncSetPowerStateConfig(dpyMcu::power_states_handler_function handler, dpyMcu::PowerStates state, std::uint32_t flags);
108 
115  void asyncSetTimersConfig(dpyMcu::timers_handler_function handler, std::uint32_t standby_min, std::uint32_t halt_min);
116 
122  void asyncSetRtcDateConfig(dpyMcu::rtc_date_handler_function handler, dpyMcu::DateConfig configDate);
123 
129  boost::system::error_code setRtcDateConfig(dpyMcu::DateConfig configDate);
130 
135  void asyncTestMisc(dpyMcu::test_misc_handler_function handler);
136 
138 
143  void asyncSetGUIDValues(dpyMcu::GUIDConfigList guids, dpyMcu::guid_handler_function handler);
145 
152  void asyncSetGpoDefValue(dpyMcu::gpio_handler_function handler, std::uint32_t gpo_number, bool gpo_value);
153 
160  boost::system::error_code setGpoDefValue(std::uint32_t gpo_number, bool gpo_value);
161 
167  void asyncGetGpoDefValue(dpyMcu::gpio_handler_function handler, std::uint32_t gpo_number);
168 
175  void asyncSetSerialPortProtocol(dpyMcu::serialport_handler_function handler, const std::string &portid, dpyMcu::SerialPortProtocol protocol);
176 
181  void asyncEnablePowerButton(dpyMcu::set_power_button_state_handler_function handler);
182 
187  void asyncDisablePowerButton(dpyMcu::set_power_button_state_handler_function handler);
188 
193  void asyncGetPowerButtonState(dpyMcu::get_power_button_state_handler_function handler);
194 
200  void asyncSetCanBusFilters(dpyMcu::result_handler_function handler, std::list<dpyMcu::CANBusFilter> &filter_list);
201 
206  void asyncResetCanBusFilters(dpyMcu::result_handler_function handler);
207 
213  boost::system::error_code setCanBusFilters(std::list<dpyMcu::CANBusFilter> &filter_list);
214 
219  boost::system::error_code resetCanBusFilters();
220 
226  void asyncSetCanBusConfiguration(dpyMcu::result_handler_function handler, dpyMcu::CANBusConfiguration conf);
227 
233  boost::system::error_code setCanBusConfiguration(dpyMcu::CANBusConfiguration conf);
234 
239  void asyncResetMcu(dpyMcu::result_handler_function handler);
240 
241 #else
242  virtual void asyncSetPowerStateConfig(dpyMcu::power_states_handler_function handler, dpyMcu::PowerStates state, std::uint32_t flags);
243  virtual void asyncSetTimersConfig(dpyMcu::timers_handler_function handler, std::uint32_t standby_min, std::uint32_t halt_min);
244  virtual void asyncSetRtcDateConfig(dpyMcu::rtc_date_handler_function handler, dpyMcu::DateConfig configDate);
245  virtual boost::system::error_code setRtcDateConfig(dpyMcu::DateConfig configDate);
246  virtual void asyncTestMisc(dpyMcu::test_misc_handler_function handler);
247  virtual void asyncSetGUIDValues(dpyMcu::GUIDConfigList guids, dpyMcu::guid_handler_function handler);
248  virtual void asyncSetGpoDefValue(dpyMcu::gpio_handler_function handler, std::uint32_t gpo_number, bool gpo_value);
249  virtual boost::system::error_code setGpoDefValue(std::uint32_t gpo_number, bool gpo_value);
250  virtual void asyncGetGpoDefValue(dpyMcu::gpio_handler_function handler, std::uint32_t gpo_number);
251  virtual void asyncSetSerialPortProtocol(dpyMcu::serialport_handler_function handler, const std::string &portid, dpyMcu::SerialPortProtocol protocol);
252  virtual void asyncEnablePowerButton(dpyMcu::set_power_button_state_handler_function handler);
253  virtual void asyncDisablePowerButton(dpyMcu::set_power_button_state_handler_function handler);
254  virtual void asyncGetPowerButtonState(dpyMcu::get_power_button_state_handler_function handler);
255  virtual void asyncSetCanBusFilters(dpyMcu::result_handler_function handler, std::list<dpyMcu::CANBusFilter> &filter_list);
256  virtual void asyncResetCanBusFilters(dpyMcu::result_handler_function handler);
257  virtual boost::system::error_code setCanBusFilters(std::list<dpyMcu::CANBusFilter> &filter_list);
258  virtual boost::system::error_code resetCanBusFilters();
259  virtual void asyncSetCanBusConfiguration(dpyMcu::result_handler_function handler, dpyMcu::CANBusConfiguration conf);
260  virtual boost::system::error_code setCanBusConfiguration(dpyMcu::CANBusConfiguration conf);
261 #endif
262 };
boost::function< void(boost::system::error_code error_code)> result_handler_function
Prototype of the handler function for obtaining the result of the operations status.
Definition: mcuApi.h:342
boost::function< void(boost::system::error_code error_code, dpyMcu::CANBusFrame frame)> get_can_bus_message_handler_function
Prototype of the handler function for getting CAN Bus Messages.
Definition: mcuApiPrivate.h:39
const std::uint32_t IGNITION_EXIT
Power states transition set to IGNITION ON.
Definition: mcuApiPrivate.h:17
boost::function< void(boost::system::error_code error_code, dpyMcu::TimersConfig &)> timers_handler_function
Prototype of the handler function for obtaining the Timers Configuration.
Definition: mcuApi.h:244
Class which interfaces with the API logic.
Definition: mcuApiPrivate.h:70
DateConfig struct which contains the response received from the service.
Definition: mcuApi.h:203
virtual ~CANBusObserver()
Destructor.
Definition: mcuApiPrivate.h:56
boost::function< void(boost::system::error_code error_code, dpyMcu::GpioConfig &)> gpio_handler_function
Prototype of the handler function for obtaining the GPIO Configuration.
Definition: mcuApi.h:293
Class which interfaces with the API logic.
Definition: mcuApi.h:351
CAN Bus Observer class.
Definition: mcuApiPrivate.h:45
Deepsy Mcu namespace that includes the different enums, structs or method signatures that should be u...
Definition: mcuApi.h:15
boost::function< void(boost::system::error_code error_code, bool enabled)> get_power_button_state_handler_function
Prototype of the handler function for obtaining the result of power button.
Definition: mcuApi.h:336
SerialPortProtocol
Serial Ports Protocol.
Definition: mcuTypes.h:72
boost::function< void(boost::system::error_code error_code, dpyMcu::SerialPortProtocolConfig &)> serialport_handler_function
Prototype of the handler function for setting the Serial Port Protocol.
Definition: mcuApiPrivate.h:32
boost::function< void(boost::system::error_code error_code, dpyMcu::GUIDConfigList &)> guid_handler_function
Prototype of the handler function for obtaining the GUIDs.
Definition: mcuApi.h:256
boost::function< void(boost::system::error_code error_code)> set_power_button_state_handler_function
Prototype of the handler function for obtaining the result of power button.
Definition: mcuApi.h:329
CAN BUS configuration structure.
Definition: mcuTypes.h:67
Power states flags that may be used.
boost::function< void(boost::system::error_code error_code, dpyMcu::DateConfig &)> rtc_date_handler_function
Prototype of the handler function for obtaining the RTC Date Configuration.
Definition: mcuApi.h:287
boost::function< void(boost::system::error_code error_code, dpyMcu::PowerStateConfig &)> power_states_handler_function
Prototype of the handler function for obtaining the Power State Configuration.
Definition: mcuApi.h:238
It contains the CAN Bus Frame structure.
Definition: mcuTypes.h:39
GUID list struct which contains the response received from the service.
Definition: mcuApi.h:170
const std::uint32_t NONE_EXIT
Power states transition set to NONE.
Definition: mcuApiPrivate.h:16
PowerStates
Possible power state to be set.
Definition: mcuApi.h:43
boost::function< void(boost::system::error_code error_code)> test_misc_handler_function
Prototype of the handler function for obtaining the current MISC status.
Definition: mcuApi.h:323
std::string port_id
Port Identifier.
Definition: mcuApiPrivate.h:23
SerialPortProtocol protocol
protocol to configure (RS232,RS485)
Definition: mcuApiPrivate.h:24
const std::uint32_t TIMERS_EXIT
Power states transition set to TIMERS Values.
Definition: mcuApiPrivate.h:18
Serial Port protocol configuration structure.
Definition: mcuApiPrivate.h:21